bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep: 'binary files' where matches are text


From: Stepan Kasal
Subject: Re: grep: 'binary files' where matches are text
Date: Fri, 7 Feb 2003 09:27:22 +0100
User-agent: Mutt/1.2.5.1i

Hello,

On Wed, Feb 05, 2003 at 04:34:29PM +0000, address@hidden wrote:
>     Search all files for matches, even binary files, but if a match is 
> found that contains binary data just print a message 'match containing 
> binary data in file X' instead of printing that match.

> As I said above, what really matters is 
> whether the _matches_ are binary, not the input files.

I cannot fully agree.  If an executable contains string

        "a few\nlines about penguins\nsre here."

and the grep finds te word ``penguins'' and happily prints

        lines about penguins

the user could then be surprised when he opens the file in his pico editor.

> There was no need for grep to be so reticent, just because there were a 
> few binary characters in the output of 'set' amid a much larger amount of 
> ASCII text.

OTOH, you are right that it's unpleasant when a file is treated as binary
even though it in fact isn't.

So I see no nice solution.  Perhaps the ``--binary-files=print_text_matches''
is the best alternative.

But I don't know when I get to it.  Are you willing to donate a patch?

Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]