概述

由于需要对tcpdump文件内容进行解析获取HOST及GET参数内容,在grep过滤时发现错误。

[root@VM-8-11-centos ~]# cat /tmp/br-be651db039e5  |grep GET
Binary file (standard input) matches

解决方法

想要按文本格式来查看需要在grep后面加-a参数即可,也就是需要使用grep -a

[root@VM-8-11-centos ~]# cat /tmp/br-be651db039e5  |grep -aA 1 GET |awk '{print $2}'
/monitor.html
blog.ym68.cc

/monitor.html
blog.ym68.cc

/links.html
blog.ym68.cc
END

本文标题:grep过滤二进制文件内容报错

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202118155.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2021 年 06 月 18 日
如果觉得我的文章对你有用,请随意赞赏