delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/19/07:11:34

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <5D139685F337FC44A97D330F8F1BF6FA07DEEB@MORSE>
From: "Dalton, Barnaby" <Barnaby DOT Dalton AT radioscape DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Grep and matching end of line (anchoring)
Date: Fri, 19 Nov 2004 12:11:19 -0000
MIME-Version: 1.0
X-IsSubscribed: yes

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 AT radioscape DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019