我是sed
的新手,但我有以下问题。在此示例中:
some text here
blah blah 123
another new line
some other text as well
another line
我想删除除包含字符串'text'和或包含字符串'blah'的行以外的所有行,因此我的输出文件如下所示:
some text here
blah blah 123
some other text as well
有什么提示可以使用
sed
完成吗? 最佳答案
这可能对您有用:
sed '/text\|blah/!d' file
some text here
blah blah 123
some other text as well
关于sed - sed删除不包含特定字符串的行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9541867/