This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Grep can't match characters before EOL marker without ^M
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Wed, 3 Jan 2018 10:56:32 -0700
- Subject: Re: Grep can't match characters before EOL marker without ^M
- Authentication-results: sourceware.org; auth=none
- References: <CAA5t8Vrr_GcYqaLq-1noAj7mxQ7KsMnd43k10-ef1anuCr60Tg@mail.gmail.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
On 2018-01-03 10:31, David Karr wrote:
> If I have a text file that has a line that ends with "abc", and I try to grep
> for "abc$", it doesn't match. I find that it does match "$" and "abc^M$".
> I've read some of the documentation about line endings in Cygwin.
> I need to write some scripting that works on both Cygwin and Linux.
> What do I need to do here?
Use grep '...[[:cntrl:]]\?$' to match, d2u|dos2unix or sed 's/\r$//' to remove.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
--
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