[Resolved] grep returns Binary file (standard input) matches

When we want to use grep on a binary file, we’d get errors like this,

$ cat /bin/cat | grep GLIBC
Binary file (standard input) matches

We can ask grep to take binary file as a text with the parameter “-a”, which is equivalent to the –binary-files=text option,

$ cat /bin/cat | grep -a GLIBC

Alternatively, we can use the command strings to print strings of printable characters in binary file, then use grep. This will make the output beautiful,

$ strings /bin/cat | grep GLIBC

Share this post

5 thoughts on “[Resolved] grep returns Binary file (standard input) matches

  1. Your approach to binary options differs from the vast majority of blog posts I browse,
    I’m impressed.

Post Comment