How do I specify spaces in findstr on Windows?
I want to include spaces after a certain word (SetupAX) that I am looking for in the file.
I am trying to find findstr command this way -
findstr /n /r "SetupAX[ \r\n\t]" XYZ.frm
However, this doesn't work. If I do not put spaces I get results as -
findstr /n /r "SetupAX" XYZ.frm
158: If Filled() Then Call SetupAXForB
170: SetupAXForC
196: SetupAX //<-- correct
242: Call SetupAX //<-- correct
276: Call SetupAXN
...
How do I get around this? I only want "SetupAX" instances, not "SetupAX ...". Thank.
How about using a word matching expression ?
findstr /n /r "SetupAX\>" XYZ.frm
findstr -n -r -c:"SetupAX[ \r\n\t]"
works only partially. It matches neither \n
, nor \r
.
With regular regular expressions, it can be written as SetupAX[ ]|$
, but findstr doesn't support alternatives ( |
). Therefore, you need to search twice: "SetupAX" and "SetupAX $"