Linux 删除已分类的行



我将文件传递给我的egrep表达式(tcpdump日志(,然后我想删除所有匹配的行

代码示例:

cat file | tr -d '00' |egrep -i 'user: | usr: ' --color=auto --line-buffered -B20

现在如何删除所有匹配的行?

使用 -v 标志

 -v, --invert-match
         Selected lines are those not matching any of the specified patterns.
cat file | tr -d '00' |egrep -iv 'user: | usr: ' --color=auto --line-buffered -B20 > newfile
您可以使用

sed来完成所有这些操作:

sed -iE '/use?r: /d; s/x0//g' file

相关内容

最新更新