gpt4 book ai didi

regex - Linux 删除egrepped行

转载 作者:太空宇宙 更新时间:2023-11-04 04:44:50 24 4
gpt4 key购买 nike

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

代码示例:

cat file | tr -d '\000' |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 '\000' |egrep -iv 'user: | usr: ' --color=auto --line-buffered -B20 > newfile

关于regex - Linux 删除egrepped行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43181953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com