Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

984.Text file parser -- How to extract all lines containing words in specified file?

User: lomboz -- 2012-08-04          << 983  985 >>
Hits: 2046
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract all lines with specified words?
Input Sample:
1.txt
<a href="http://xxxx.com">aaaaa</a>
<a href="http://yyyy.com">bbbbb</a>
<a href="http://cccc.com">ccccc</a>
<a href="http://ffff.com">zzzzz</a>

2.txt
aaaaa
ccccc

Output Sample:
<a href="http://xxxx.com">aaaaa</a>
<a href="http://cccc.com">ccccc</a>
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume the full path name of 2.txt is d:\test\2.txt
1. ctrl-o open 1.txt
2. ctrl-h open 'replace' dialogue
(1) set 'replace unit' to 'Line'
(2) set 'replace with pattern' to:

(3) uncheck option of "print unmatched unit"
(4) set 'if' to:

(5) click 'advanced' tab, set 'run following at the beginning of replace' to:

3. click 'replace', done.

Note: you need to use real filename to take place of d:\\test\\2.txt in step 2(5), use double backslash(\\) as folder delimiter.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to extract random lines containing specified words? (78%)
How to extract all lines that contain specific words in a file? (78%)
How to extract lines containg specified words from many files? (75%)
How to extract all lines that contain words in a list? (75%)
How to extract all lines that contain words A and B and C? (75%)
How to delete all lines containing specific word in specific column? (74%)
How to extract all records that contains specified field values? (73%)
How to extract all lines that contain specified words or phrases? (71%)

Check Demo of Text file parser
Keywords:
extract all lines containing  extract all lines contain  backslash  double  path  lines containing  slash  specified words  full  how to extract all lines with  extract double lines  extract double words  extract lines containing  extract lines containing pattern  double words  folder path  double lines  extract specified lines