Grep and matching end of line (anchoring)

Shankar Unni shankarunni@netscape.net
Fri Nov 19 19:22:00 GMT 2004


Dave Korn wrote:

>   What makes you think grep understands ^ notation to indicate control
> chars?  It doesn't say so in the info page.  (It doesn't recognize [\r]
> either.)

Umm, you're probably jumping to the wrong conclusion about the OP's intent.

He probably meant the literal character ^M, which you have to enter as 
^V^M (control-v control-m) on the command line.

And you have to *pipe* the input into grep, not pass in the file as a 
command line (in textmode mounts, this will cause grep to read the file 
as a text file).

This works just fine:

    cat test.dos.txt | grep 'ld^M$'

*if* you entered ^M on the commnand line as Control-V Control-M.


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



More information about the Cygwin mailing list