Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

603.Text file parser -- How to findout all lines that contain specified words in multiple files?

User: editor -- 2010-09-01          << 602  604 >>
Hits: 4101
Type: Text file parser   
Search all Text file parser examples
Description:
How to findout all lines that contain specified words in multiple files? 
 
The unix "grep" command and DOS "findstr" command can search all lines that contain specified words like "abc": 
file1: .....abc..... 
file2: ...abc........ 
 
How to use 'Replace Pioneer' to search files in subfolder to findout all lines that contain "abc"?
Input Sample:
some files might contain "abc", but they are in different subfolder of d:\test
Output Sample:
Find out all lines that contain abc in different files: 
d:\test\subfolder1\file1: .....abc.... 
d:\test\subfolder2\file2: ...abc..... 
d:\test\subfolder2\file2: .....abc..... 
....
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-h open 'Replace' window 
* set 'Replace Unit' to 'Line' 
* in 'Search for pattern' entry, enter: 
 
* in 'Replace with pattern' entry, enter: 
 
* uncheck 'Print Unmatch Unit' option(to remove other lines) 
* change the symbol ">" between "In Page(p0)" and "Out Page(p1)" to ">> Append" 
2. click "Batch..." button open "Batch Runner" window 
3. click "Search Files" button, to search specified files: 
* set proper filter, such as *.txt, set proper directory 
* set "Contain Word/Phrase" to "abc"(can ignore this step) 
* check the option of "search subdirectory" 
* click "Search", click "Close" on finish. 
4. Check "Set output File" option, and clear the following entry(default is ${FILENAME}, now fill it as blank) 
5. click "Batch Replace", done! all lines are listed in page "P1"

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all lines that contain specific words in a file? (80%)
How to extract all lines that contain specified words or phrases? (77%)
How to extract lines containg specified words from many files? (75%)
How to extract all lines that contain "abc" from multiple files? (75%)
How to extract all sentences that contain special keyword from multiple articles? (74%)
How to find out all lines that appeared specified number of times? (73%)
How to remove lines containing specified words in a text file? (72%)
How to remove all lines that contain some specific strings in a text file? (72%)

Check Demo of Text file parser
Keywords:
findstr  unix  rope  subfolder  dos  subdirectory  phrase  grep  command  specified words  findstr subfolder  remove words between  multiple file search with the findstr  search all files in subfolder  remove all symbol  multiple command  ignore lines  remove all lines multiple