I use Windows 7 and often use the FINDSTR command to search in * .log files.
I would like to ask if it is possible to search for whole words only.
Because often when I type:
findstr "su" *.log
I get:
su
super
unsubscribe
etc.
2 options, depending on the requirements. Consider you want all lines where su
is a standalone word in a string:
user can su
su
super
unsubscribe
then run use word boundary with regex
:
findstr /rc:"\<su\>" *.log
which will match both:
user can su
su
if however you only want the standalone word in a string su
, then use ex
act match:
findstr /x "su" *.log
add /i
if your word needs to be matched in upper, lower or mixed case.