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: 404
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 find out all lines that appeared specified number of times? (73%)
How to remove all lines that contain some specific strings in a text file? (72%)
How to find all lines in file A that contain words in file B? (72%)
How to find out all files that contain all words of A, B and C? (70%)
How to extract all sentences that contain specified words? (69%)
How to filter out all web pages that does not contain specified words? (68%)
How to add bold tag for some specified keywords in multiple html files? (68%)
How to remove all the lines that with odd line number for multiple files? (68%)

Check Demo of Text file parser
Keywords:
unix  subfolder  grep  subdirectory  dos  command  abc  symbol  sym  blank  findstr subfolder  search all files in subfolder  remove all symbol  between lines  lines contain words  remove txt  remove specified  symbol pattern