Grep '二进制文件匹配'.如何获得正常的grep输出? [英] Grep 'binary file matches'. How to get normal grep output?

查看:26
本文介绍了Grep '二进制文件匹配'.如何获得正常的grep输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个递归搜索目录的 grep 脚本.

I've got a grep script that searches through a directory recursively.

grep -n -R -e 'search term' -e 'second search term' ./ 

但是我得到的结果如下.请注意,在 JPG 中找到了匹配项,但没有实际结果.

However the results I get are the following. Notice there are found matches in JPGs but no actual result.

Binary file ./jpg/00015928.jpg matches
Binary file ./jpg/00015296.jpg matches
Binary file ./jpg/00020072.jpg matches

有什么办法可以像普通的grep搜索一样在输出中查看结果?

Is there any way to see the result in the output like a normal grep search?

推荐答案

尝试:

grep --text

grep -a 

简称.这等效于 --binary-files=text 并且它应该显示二进制文件中的匹配项.

for short. This is equivalent to --binary-files=text and it should show the matches in binary files.

这篇关于Grep '二进制文件匹配'.如何获得正常的grep输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆