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: 1949
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 extract all lines that contain words in a list? (78%)
How to remove all lines that contains more than one word? (77%)
How to delete all lines that contain only a word and a blank? (76%)
How to remove lines that contain some words base on percentages? (74%)
How to extract all lines that contain specific words in a file? (70%)
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%)

Check Demo of Advanced search and replace
Keywords:
replacing  whole word  whole  newline  more word  nth  many word  remove all lines  or more  any word  whole words only  delete all lines that contain  delete lines that match word  delete lines more  match whole word  whole words  delete lines with word  delete list