我与这个文件中的数据,看起来像这样的工作:替换所有行不包含匹配的字符串
text in file
hello random text in file
example text in file
words in file hello
more words in file
hello text in file can be
more text in file
我试图替换做不包含字符串的所有行hello
与match
使用SED,所以输出会是:
match
hello random text in file
match
words in file hello
match
hello text in file can be
match
我尝试使用sed '/hello/!d'
但删除线。另外,我读到我可以在sed中使用!
进行匹配,但我不确定如何匹配每一行并正确替换。如果你能给我一些指导,我会很感激。
这完美的作品。谢谢你的协助。这是有道理的。如果你有一分钟的时间,请立即开通。 – DomainsFeatured