Grep“二进制文件匹配".如何获得正常的grep输出? [英] Grep 'binary file matches'. How to get normal grep output?
本文介绍了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屋!
查看全文