When trying to find a string pattern in a file grep returns the standard input of the binary file
I'm on Ubuntu and I typed cat .bash_history | grep git
and it returned
Binary file (standard input) matches
My bash_history
does exist and there are many lines in it that starts with git
.
What causes the error? how can i fix it?
Best Answer
You can use grep -a 'pattern'
.
from man grep page.
-a, --text
Process a binary file as if it were text; this is equivalent to the --binary-files=text option.