| User: editor -- 2009-12-30 |
| Hits: 140 |
| Type: Regular expression replace |
| Search all Regular expression replace examples |
| Description: |
| How to remove all lines that contains more than one word? I want to remove all phrases that listed in a text word list, and keep the single word. |
| Input Sample: |
| hello hello world welcome no problem bye |
| Output Sample: |
| hello welcome bye |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" to finish following steps. |
| 1. ctrl-o open source text file that containing words. 2. ctrl-h open 'Replace' dialog: * set 'Replace Unit' to 'Line' * in search for pattern enter: 3. click 'Replace', all lines that has 2 words at least(matches \w+\s+\w+) will be removed. 4. ctrl-s save to target file |
| Download Script: scripts/378.rst.zip |
Similar Examples: |
| How to remove all the lines that do not contain any of words in a list? (75%) How to remove all lines that shorter than 10 characters? (72%) How to remove all lines that are not ended with word "ok" or "done"? (67%) How to extract all lines that contain words A and B and C? (65%) How to remove all duplicated lines without considering the last word? (64%) How to extract all lines that contain A, but not any of B C D? (64%) How to find out all files that contain both A and B and copy to a new folder? (63%) How to removing all leading zeros in a text file containing many numbers? (63%) |
Check Demo of Regular expression replace |