> -----Original Message----- > From: cygwin-owner On Behalf Of Buchbinder, Barry (NIH/NIAID) > Sent: 19 November 2004 15:17
> This should work whether or not one is on a text mount or for > the file has DOS or Unix line endings: > > cat files.txt | grep -E '\.h^M?$' Always test before posting. Even a one liner. That doesn't work, or at least NFM: [EMAIL PROTECTED] /test/grep-test> od -c test.dos.txt 0000000 H e l l o w o r l d \r \n 0000015 [EMAIL PROTECTED] /test/grep-test> od -c test.unix.txt 0000000 H e l l o w o r l d \n 0000014 [EMAIL PROTECTED] /test/grep-test> grep -E 'ld^M?$' * [EMAIL PROTECTED] /test/grep-test> grep -E 'd^M?$' * [EMAIL PROTECTED] /test/grep-test> grep -E '.^M?$' * [EMAIL PROTECTED] /test/grep-test> Grep knows there's a char there, but it won't match it with ^M. [EMAIL PROTECTED] /test/grep-test> grep -E '.$' * test.dos.txt:Hello world test.unix.txt:Hello world [EMAIL PROTECTED] /test/grep-test> grep -E 'd.$' * test.dos.txt:Hello world [EMAIL PROTECTED] /test/grep-test> grep -E 'd^M$' * [EMAIL PROTECTED] /test/grep-test> grep -E 'd^m$' * [EMAIL PROTECTED] /test/grep-test> 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.) Actually, it seems that grep cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/