News for hackers. Stuff that matters.
Re:If you use GNU grep on text files, use the -a (--text) op... by downerending on Tuesday April 21, 2020 @02:30PM (#22937867)
Usually you want this feature no matter where the output is going. Adding "-a" sucks, but it's not obvious how else this could work (and still be backward-compatible).

IIRC the grep heuristic only considers a short prefix of the file. If the garbage comes later, you lose. Unfortunately, this makes things seem a bit unpredictable.

Re:If you use GNU grep on text files, use the -a (--text) op... by gumby on Tuesday April 21, 2020 @02:44PM (#22938029)
> IIRC the grep heuristic only considers a short prefix of the file. If the garbage comes later, you lose. Unfortunately, this makes things seem a bit unpredictable.

This was changed about five years ago to just keep looking. Which makes things a bit unpredictable in a different way.

Re:If you use GNU grep on text files, use the -a (--text) op... by linsomniac on Wednesday April 22, 2020 @10:28AM (#22945911)
I probably do not want this feature the case of a script, as this post talks about. Which is why I was suggesting if isatty(stdout). Most people do not want their shell scripts functionality to depend on whether there is a "high character" somewhere in it.