Web lists-archives.com

Re: grep 3.0-2 not stripping CRs on Windows

On Mon, 17 Dec 2018 13:22:48, Ondřej Surý wrote:
# 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

Your commands are failing because you are not accounding for the carriage
returns. as was said, this change was intentionally done for the purpose of
making scripts MORE portable:


if you want to keep your grep command, you need to remove CR first:

   $ printf 'alpha\r\nbeta\r\n' > CRLF.txt
   $ tr -d '\r' < CRLF.txt | grep 'a$'

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