I have a folder with one hundred and some htmls.I want to find an exact match to any complete word I search for and display it in a text file.The latest attempt still failed:
for %%f in (*.html) do findstr /m /p /c:"cop.rar" "%%f" >> exact-results.txt
What the above only does is shows the results of the name.html files that the word cop is in.
Examples it found: 69cop.rar , 75cop.rar , lastcop.rar , anothernamecop.rar
No good....what I want is the EXACT word only that I search for.
If I search for cop.rar , I only want the name of the html(s) that cop.rar would be in.Thanks for your help!
Val
Search for EXACT word using a Batch file - Help!
Moderator: DosItHelp
Re: Search for EXACT word using a Batch file - Help!
Use regular expressions (option /r) and word boundaries.
Steffen
Code: Select all
findstr /rmpc:"\<cop\.rar\>" "%%f"
Steffen
Re: Search for EXACT word using a Batch file - Help!
Steffen...
Thanks! I appreciate it a bunch.This works like a charm!
for %%f in (*.html) do findstr /rmpc:"\<cop\.rar\>" "%%f" >> found-xact-complete-name.txt
Problem solved...
Val
Thanks! I appreciate it a bunch.This works like a charm!
for %%f in (*.html) do findstr /rmpc:"\<cop\.rar\>" "%%f" >> found-xact-complete-name.txt
Problem solved...
Val