Linux 删除 egreped 行

Linux delete egrepped lines

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

代码示例:

cat file | tr -d '[=11=]0' |egrep -i 'user: | usr: ' --color=auto --line-buffered -B20

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

您可以使用 sed:

完成所有操作
sed -iE '/use?r: /d; s/\x0//g' file

使用 -v 标志

 -v, --invert-match
         Selected lines are those not matching any of the specified patterns.
cat file | tr -d '[=11=]0' |egrep -iv 'user: | usr: ' --color=auto --line-buffered -B20 > newfile