[PLUG] grep and binary file response
Russell Senior
seniorr at aracnet.com
Sat Nov 26 07:10:03 UTC 2005
>>>>> "Keith" == Keith Morse <kgmorse at mpcu.com> writes:
Keith> When I issue a " grep 8119 .bash_history ", grep returns "
Keith> Binary file .bash_history matches " in the output. I
Keith> understand the implications on grepping a binary file, but
Keith> .bash_history certainly not one. Applying a " -a " to grep
Keith> works, but why should I have to? Is there something in the
Keith> enviroment that would cause this behaviour?
$ man grep
and look for "binary".
Searching from the top, the first one is:
-a, --text
Process a binary file as if it were text; this is equivalent to
the --binary-files=text option.
The next "hit" is this, which I think explains what you are seeing:
--binary-files=TYPE
If the first few bytes of a file indicate that the file contains
binary data, assume that the file is of type TYPE. By default,
TYPE is binary, and grep normally outputs either a one-line mes-
sage saying that a binary file matches, or no message if there
is no match. [...]
I'd recommend taking a look at the top of .bash_history to see if
there are any accented characters that aren't strictly ASCII.
--
Russell Senior ``I have nine fingers; you have ten.''
seniorr at aracnet.com
More information about the PLUG
mailing list