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

BashGrep

Bash Problem Overview


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?

Bash Solutions


Solution 1 - Bash

Try:

grep --text

or

grep -a 

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondavidbainView Question on Stackoverflow
Solution 1 - BashperrealView Answer on Stackoverflow