Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

888.Advanced search and replace -- How to remove all lines that contain one or more words in a list?

User: brucelee -- 2011-11-17          << 887  889 >>
Hits: 210
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
File A has many words, file B has many lines that contain words from file A, how to delete these lines from file B?
I don't want the lines in file B.
Input Sample:
File A:
word1
word2
word3
...
File B:
-----word1----
aaaaaaaaaa
word2------
---word3-----
bbbbbbbbb
.........
Output Sample:
aaaaaaaaaa
bbbbbbbbb
.......
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
You can change file A to following format by replacing all "\n"(newline) with "|":
(word1|word2|word3|...wordn),then:
1. ctrl-o open file B
2. ctrl-h open 'replace' dialog:
* set 'replace unit' to 'Line'
* set 'search for pattern' to:

3. click 'replace', done.

Note: if you need match the whole word only, you can use:

Screenshot 1:  Replace_Window


Similar Examples:
How to remove all the lines that do not contain any of words in a list? (83%)
How to remove all lines that contains more than one word? (77%)
How to extract all lines that contain words A and B and C? (70%)
How to remove all lines that contain some specific strings in a text file? (68%)
How to findout all lines that contain specified words in multiple files? (67%)
How to remove all lines that are not ended with word "ok" or "done"? (67%)
How to find all lines in file A that contain words in file B? (65%)
How to remove all lines that contain ABC but not contain DEF in text file? (65%)

Check Demo of Advanced search and replace
Keywords:
whole  newline  more word  nth  many word  or more  remove all line  how to delete  delete  delet  delete lines that match word  whole words only  delete all lines that contain  delete lines with word  match whole word  whole words  replace whole word  how to remove lines that contain