On Fri 09 Mar 2018 16:09:35 Ralph Corderoy wrote:
> That seems unlikely.  grep thinks files are binary if they contain ASCII
> NUL, or have a byte sequence that's invalid for the locale, and it only
> emits that `Binary file ... matches' if such a line matches the regexp.
> 
> Does your grep behave like this?  I used a UTF-8 terminal.
> 
>     $ od -tx1z <<<$'x\xa0\xa0y'
>     0000000 78 a0 a0 79 0a                                   >x..y.<
>     0000005
>     $ LC_ALL=en_GB.utf8 grep z <<<$'x\xa0\xa0y'
>     $ LC_ALL=en_GB.utf8 grep z <<<$'x\xa0\xa0y\nz'
>     z
>     $ LC_ALL=en_GB.utf8 grep y <<<$'x\xa0\xa0y'
>     Binary file (standard input) matches
>     $ LC_ALL=en_GB.iso88591 grep y <<<$'x\xa0\xa0y'
>     x��y
>     $ LC_ALL=C grep y <<<$'x\xa0\xa0y'
>     x��y
>     $
> 
> -- 
> Cheers, Ralph.

Your example which produces the "Binary file" message, produces this:-

[derij@pip build (master)]$ LC_ALL=en_GB.utf8 grep y <<<$'x\xa0\xa0y'
x��y

So I am not seeing the message. I looked for any aliases and found:-

alias grep='grep --color'

So I unaliased it and ran again, with same result, except the "y" was not 
coloured.

I don't know why I don't see the message!

Cheers 

Deri


Reply via email to