This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Grep and matching end of line (anchoring)


I'm having trouble gettting grep to match end of line when used with
files/utlilities that use DOS linefeeds. For example:

cat files.txt | grep '\.h$'

produces no output. However, if I stick a filter in the middle to change the
line endings:

cat files.txt | perl -pe 's/\r\n/\n/' | grep '\.h$'
I get:

file1.h
file2.h

as expected.

Should grep's $ match \r\n or should I expect to have to convert line
endings?

Thanks
Barney

Version info:
grep (GNU grep) 2.5
CYGWIN_NT-5.0 1.5.12(0.116/4/2) 2004-11-10 08:34





**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
postmaster@radioscape.com.

This footnote also confirms that this email message has been scanned
for the presence of computer viruses known at the time of sending.

www.radioscape.com
**********************************************************************


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]