Web lists-archives.com

Re: grep 3.0-2 not stripping CRs on Windows

Hi Michael,

ah, there was a similar change for sed, that’s why I missed it when searching for the change.

I believe this is slightly different case, as the pipes were only included in the example I sent.  The grep fails to match CRLF to $ even if physical files are involved and `-a` option is enforced:

# Create file with CRLF
$ echo -ne 'foo\r\n' > crlf.txt

# Use 2.27-2 version -> works OK
$ ./grep-2.27-2.exe 'foo$' crlf.txt

# Use --binary —> doesn’t find anything OK
$ ./grep-2.27-2.exe -U 'foo$’ crlf.txt

# Use —text —> finds the text OK
$ ./grep-2.27-2.exe -a 'foo$' crlf.txt

# No amount of options makes the grep find the text in the file
$ ./grep-3.0-2.exe 'foo$’ crlf.txt
$ ./grep-3.0-2.exe -U 'foo$' crlf.txt
$ ./grep-3.0-2.exe -a 'foo$’ crlf.txt

So. I would be perfectly fine, if I had to slap `-a` to every grep command reading text output, because the default has changed.

Sed doesn’t have --text option, so sure, there’s no other option available.

Ondřej Surý

> On 17 Dec 2018, at 13:04, Soegtrop, Michael <michael.soegtrop@xxxxxxxxx> wrote:
> Dear Ondrej,
> this has been discussed to quite some length and detail more than once on this list. The initial message of a lengthy discussion (> 30 replies) on the topic is here:
> https://www.cygwin.com/ml/cygwin/2017-06/msg00040.html
> Best regards,
> Michael
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple