搜索字符串,如果不存在则打印行,批处理文件

时间:2022-07-17 13:53:16

So I am trying to write a batch script which would read a file and print the lines which doesn't contain a particular string. I know Findstr can output the line if the string is found, but I want to do the opposite. For example:

所以我正在尝试编写一个批处理脚本来读取文件并打印不包含特定字符串的行。我知道如果找到字符串,Findstr可以输出该行,但我想做相反的事情。例如:

Some text errorcode:0
Some more text errorcode:0
Different text errorcode:1

I want to output the lines which doesn't contain the string 'errorcode:0' Any pointers?

我想输出不包含字符串的行'errorcode:0'任何指针?

1 个解决方案

#1


1  

findstr /v Thanks Ken Y-N for the answer.

findstr / v感谢Ken Y-N的回答。

#1


1  

findstr /v Thanks Ken Y-N for the answer.

findstr / v感谢Ken Y-N的回答。