User: Aaron -- 2015-11-03 << 1320 1322 >> |
Hits: 2909 |
Type: Text file parser |
Search all Text file parser examples |
Description: |
I would like a version of script 1108 that extracts a single random line from multiple files that matches a word or phrase in a list and writes those single random lines to a new text file. |
Input Sample: |
Batch input files: file1.txt Bob drives his car. I will travel to England. Sue did not travel to Mexico. Frank stayed home. Did Mark travel to Europe? etc. file2.txt Steve is going home. I would like a new car. The travel agency is closed. The children are at home Is travel to Europe expensive? etc. file3.txt Should I travel by plane or boat? She would like to travel to Europe. He was in a car accident. Is Joe still at home? etc. |
Output Sample: |
Words and phrases in a list file: home car travel to Europe travel etc. Sample output text files: New_file.txt Frank stayed home. I would like a new car. She would like to travel to Europe. The travel agency is closed. or New_file.txt Steve is going home. He was in a car accident. Did Mark travel to Europe? Should I travel by plane or boat? etc. |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open the list file, e.g. d:\test\words.txt 2. ctrl-h open 'replace' dialogue: * set 'replace unit' to 'Line' * set 'replace with pattern' to: * click 'advanced' tab: set 'run following at the beginning of replace' to: 3. click 'replace', done. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |