delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/19/14:22:13

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
To: cygwin AT cygwin DOT com
From: Shankar Unni <shankarunni AT netscape DOT net>
Subject: Re: Grep and matching end of line (anchoring)
Date: Fri, 19 Nov 2004 11:21:54 -0800
Lines: 20
Message-ID: <cnlh4j$1kf$1@sea.gmane.org>
References: <F76C9B2DA2FC4C4CA0A18E288BBCBCF71026EB0B AT nihexchange24 DOT nih DOT gov> <NUTMEGc0xvlUQ9cAgjH000000f0 AT NUTMEG DOT CAM DOT ARTIMI DOT COM>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: adsl-68-120-146-125.dsl.snfc21.pacbell.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041103 Thunderbird/0.9 Mnenhy/0.6.0.101
In-Reply-To: <NUTMEGc0xvlUQ9cAgjH000000f0@NUTMEG.CAM.ARTIMI.COM>
X-IsSubscribed: yes

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/

- Raw text -


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