Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1248.Text file parser -- How to extract all lines that contain specific words in a file?

User: yong -- 2014-09-12          << 1247  1249 >>
Hits: 1459
Type: Text file parser   
Search all Text file parser examples
Description:
If the lines not contains the specific words, then delete this line, please see the source text sample
Input Sample:
<a href="http://www.aaaa.com/111.html">111</a>
<a href="http://www.aaaa.com/222.html">222</a>
<a href="http://www.aaaa.com/333.html">333</a>
<a href="http://www.aaaa.com/444.html">444</a>
<a href="http://www.aaaa.com/555.html">555</a>
<a href="http://www.aaaa.com/666.html">666</a>
<a href="http://www.aaaa.com/777.html">777</a>
text 2:
http://www.aaaa.com/111.html
http://www.aaaa.com/333.html
http://www.aaaa.com/555.html
Output Sample:
<a href="http://www.aaaa.com/111.html">111</a>
<a href="http://www.aaaa.com/333.html">333</a>
<a href="http://www.aaaa.com/555.html">555</a>
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume file d:\test\2.txt contain list of words/phrases.
1. ctrl-o open source text file need to be replaced.
2. ctrl-h open 'replace' dialogue
* set 'replace unit' to 'Line'
* set 'if' to: 
* click 'advanced' tab, set 'run following at the beginning of replace' to:

3. click 'replace', done.
4. ctrl-s save to file.

Note: 
* in step 2, please use double backslash for folder delimiter, such as d:\\test\\2.txt
* no blank line is allowed at the middle or bottom of 2.txt

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to extract all lines that contain specified words or phrases? (87%)
How to extract all lines that contain words in a list? (85%)
How to extract lines containg specified words from many files? (83%)
How to extract sentences that contain specified words from UTF8 file? (83%)
How to extract all sentences that contain specified words? (83%)
How to extract all lines that contain words A and B and C? (83%)
How to findout all lines that contain specified words in multiple files? (80%)
How to extract all lines containing words in specified file? (78%)

Check Demo of Text file parser
Keywords:
specific words  phrases  specific word  middle  phrase  bottom  specific  backslash  double  slash  double blank lines  extract double lines  extract specific  parser split file open source  extract specific text  join blank lines  delete blank lines of text file  delete all lines that contain