--line-regexp option with null data
Fri Jul 17 02:04:00 GMT 2015
Steven Penny svnpenn-at-gmail.com |cygwin_ml_nodigest| wrote at 20:29 -0500 on Jul 16, 2015:
> Consider this command:
> printf 'alpha\nbravo\ncharlie\n' | grep --line-regexp --quiet bravo
> grep sees 3 lines separated by newline, and matches the bravo line. Now consider
> this command:
> printf 'alpha\0bravo\0charlie\0' | grep --line-regexp --quiet bravo
> My thinking tells me that because I have not used `--null-data`, grep should see
> 1 or even 0 lines separated by newline, and fail to match a `bravo` followed by
> newline. However it does not, it succeeds just like the first command, why is
> Note I also tried this on Debian with Grep 2.2 and it works as expected.
cygwin grep is detecting the input as binary which seems to be
overriding the 'match the whole line' behavior of --line-regexp. Get
rid of --quiet to see that.
That does seem like a bug in the cygwin implementation of grep to me.
As a workaround for this simple example, you can add -a (aka --text)
to force it to treat the input as text.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin