I need to find the string "substring1 substring2" in a datafile of a current directory. I use the cmd of Windows-10. I use the following command according the Windows documentation:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr#examples
findstr /c:"hello there" x.y
In this way it doesn't find anything, allthough the string is present. When I use the same instruction without ':'
findstr /c:"hello there" x.y
it shows me all cases of 'hello' and all cases of 'there'.
Here it is the concrete case:
findstr /c: "INVITE sip:" .\*5656*.dat
FINDSTR: Argoment not found after /c
Pls. help
This works fine for me, so I guess it is an issue of case sensitivity. You might need to add /i
, like this:
findstr /c:"INVITE sip:" /i *5656*.dat
You mention without ':'
, but the command is just like the previous one (maybe you mean no colon after "sip"?). It won't work without the colon in the parameter, the colon in the string works just fine. I am not sure if findstr
looks for the words separately ("it shows me all cases of 'hello' and all cases of 'there'"), I wasn't able to do that. And your final example won't work either because of the extra space after the colon.
In case this does not work at all, are the files in a subfolder? Have you tried simpler terms and then start adding words to the string? Do they have any special characters?
Update
Based on your comments, there might be a carriage return character in the outputted string, so what you can do is redirect the console output to a file, and then open that file, preferably with something better than Notepad, like Notepad++.
findstr /c:"INVITE sip:" *5656*.dat > results.txt