Windows 'findstr' command: Exclude results containing particular string

二次信任 提交于 2019-12-01 00:25:38

问题


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?


回答1:


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.



回答2:


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



来源:https://stackoverflow.com/questions/23511172/windows-findstr-command-exclude-results-containing-particular-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!