How do I do a findstr if I'm looking for more than 1 string?
This is what I have...but it's not looking for either or, it's only finding one?
findstr /I d10-p.sc.xxx.com cats5c.sc.xxx.com
if not %errorlevel==0%
goto END
findstr for multiple searches?
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Put the multiple strings to search for inside quotes, separated by spaces. Use the /c option if you want to search for the phrase instead of each individual string:
searches for any line that contains string1 OR string2 inside path:\file.txt
searches for the exact phrase "string1 string2" (without the quotes) in the file path:\file.txt
Great stuff here:
http://www.ss64.com/nt/findstr.html
Code: Select all
findstr /i "string1 string2" "path:\file.txt"
searches for any line that contains string1 OR string2 inside path:\file.txt
Code: Select all
findstr /i /c:"string1 string2" "path:\file.txt"
searches for the exact phrase "string1 string2" (without the quotes) in the file path:\file.txt
Great stuff here:
http://www.ss64.com/nt/findstr.html