User: Aaron -- 2013-12-09 << 1155 1157 >> |
Hits: 3125 |
Type: Text file parser |
Search all Text file parser examples |
Description: |
Variation of script 560. How to remove all the lines that do not contain any of words in a list based on percentages? |
Input Sample: |
word_list.txt word1|word2|word3 Keep only 50% of lines with word1 and all occurrences of word2 and word3 input.txt .....word1...... ............... ....word1........ ..word2........... ................. ............ ..word3........... |
Output Sample: |
Output Sample: (50% of lines with word1 remain) .....word1...... ....word2........ ..word3........... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open 'text' file 2. ctrl-h open 'replace' dialogue * set 'replace with pattern' to: * click 'advanced' tab set 'run following for each matched unit' to: 3. click 'replace', done. Note: you can adjust 0.5 to other values. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |