Grep 获得除匹配之外的所有内容

agz*_*agz 0 bash grep regex

假设我有一个文本文件,上面写着:

Hello my name is agz.
I am asking a question that is important.
Run Code Online (Sandbox Code Playgroud)

如果我输入: grep -v "is" /path/to/file,我应该没有输出,因为两行都有“is”。

如果我输入:grep -o "is" /path/to/file,我应该得到:

is
is
Run Code Online (Sandbox Code Playgroud)

但是我想得到:

Hello my name agz.
I am asking a question that important.
Run Code Online (Sandbox Code Playgroud)

(只是缺少的是)有没有办法使用 grep 和最小正则表达式来实现这一点?

Dan*_*eck 9

grep不是这项工作的正确工具。sed是。

$ sed 's|is||g' test.txt
Hello my name  agz.
I am asking a question that  important.

$ sed 's|is ||g' test.txt
Hello my name agz.
I am asking a question that important.
Run Code Online (Sandbox Code Playgroud)