Grep 'binary file matches'. How to get normal grep output? [duplicate]

这一生的挚爱 提交于 2020-11-26 04:55:15

问题


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

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

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

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


回答1:


Try:

grep --text

or

grep -a 

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



来源:https://stackoverflow.com/questions/23512852/grep-binary-file-matches-how-to-get-normal-grep-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!