Thomas' Tech Tips

Have grep show results from binary files

20 February 2022 - Thomas Damgaard

By default grep hides results found in binary files. Instead of the actual matching line, it just shows a note that a match was found:

Binary file data.bin matches

Sometimes you want to actually have grep print the result, although rarely to STDOUT.

grep -a or grep --text will do this.

grep -a is equivalent to grep --binary-files=text

Filed under: grep, shell, tips

Back to article list