grep 3.0-2 not stripping CRs on Windows
Steven Penny
svnpenn@gmail.com
Mon Dec 17 13:05:00 GMT 2018
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:
https://cygwin.com/ml/cygwin/2017-02/msg00155.html
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$'
alpha
beta
--
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
More information about the Cygwin
mailing list