find list of strings in a subdirectory

April 25, 2010 at 11:06:13
Specs: Windows XP
i have some text files in a directory. i need to find if a specific string is there in those text files and export the line containing the string.

there are a list of such strings (STRING1, STRING2, STRING3 etc) i need to find in each text file.


See More: find list of strings in a subdirectory

Report •

#1
April 25, 2010 at 11:09:23
Suggested reading:
findstr /?


Report •

#2
April 25, 2010 at 11:59:31
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s/a-d c:\files\*.txt') do (
for /f "tokens=* delims= " %%i in (strlist) do (
find "%%i" < "%%a" >> newfile
)
)


=====================================
Helping others achieve escape felicity

M2


Report •
Related Solutions


Ask Question