Windows 'findstr' command: Exclude results

2019-04-25 07:39发布

To the command findstr str1 *.* I want to add something that will exclude the results which contain the string str2.

In Linux the way of doing it is to add | grep -v str2 (to grep str1 * of course). Is there an equivalent flag to -v in Windows?

2条回答
够拽才男人
2楼-- · 2019-04-25 08:16

use /V, for example: findstr "hello world" *.cpp | findstr /V ".git\\"

查看更多
等我变得足够好
3楼-- · 2019-04-25 08:28

Is there an equivalent flag to -v in Windows?

The equivalent to -v is /V.

C:\Users\Todd>findstr /?
Searches for strings in files.

...

/V         Prints only lines that do not contain a match.
查看更多
登录 后发表回答