如何消极地使用grep?

yuk*_*say 1 grep

我想做与 grep 做的相反的事情。我想排除具有特定模式的输出行。

我想要的是一个命令“ngrep”:

$ output
hi how are you?
hi hi haw are you?
hu hi how are you?
haw haw haw are you?

$ output | ngrep 'haw' :
hi how are you?
hu hi how are you?
Run Code Online (Sandbox Code Playgroud)

seb*_*sth 5

grep 手册页

   -v, --invert-match
          Invert the sense of matching, to select non-matching lines.
Run Code Online (Sandbox Code Playgroud)