delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/01/03/12:56:50

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=pFcdlmQrsTUxXD80
cMNQJIuCEUuUKTSowZLgHVHyXzdca+AA1n+wCJTdShULdhClYcSLXeSQXzw9vSFM
BiC4tQWfQ3d7u8i+CcGOxrk6EM0bDTUWTSCkf0OlyO9y1DusixP2RPV+TfDxRLZb
9MsqUqMqA1+6kuOyb7iVNKkKq2A=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=fuWmJ9E4bbmWCP3Ado+FWn
Ecas4=; b=iLej+3uy84LDIDZ3orJ9zRfNzNBrgGeb0V97do7Xn0PtzfSu2CFEbn
Yt5sxwlYeRi04t6Cl8lxJYn55s2YpvypqcaMM3R/QARkuB3Z9noZ+9v9BpVpx66u
qU4comPaYIW84Z95ve2b+9uYB5dkJcUZOwYuFtZvVSPUMtuDxp5c0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=brian, Brian, calgary, Calgary
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=M/g9E24s c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=N659UExz7-8A:10 a=w5aJ8kaLLAry8Qfnm_kA:9 a=pILNOxqGKmIA:10
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: Grep can't match characters before EOL marker without ^M
To: cygwin AT cygwin DOT com
References: <CAA5t8Vrr_GcYqaLq-1noAj7mxQ7KsMnd43k10-ef1anuCr60Tg AT mail DOT gmail DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Message-ID: <9391def3-f324-e8fd-ff5d-76fc8848dcca@SystematicSw.ab.ca>
Date: Wed, 3 Jan 2018 10:56:32 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0
MIME-Version: 1.0
In-Reply-To: <CAA5t8Vrr_GcYqaLq-1noAj7mxQ7KsMnd43k10-ef1anuCr60Tg@mail.gmail.com>
X-CMAE-Envelope: MS4wfHDCfGAnHjRwyVCWTu7j0wiwaiDzykk0QpWp92Jt4r2Zw+2UXVQVSCd25W8QbWgc9IToPPGdnxYM9/EM9+ecxUu9LTjldhZQcx18prQmcbjXbRF0nzVi RyfbFFE3AjgzDomsuXI7DWK3TfQVxkbGNWlCxooZWlfo9jI/O1/QnhZVdRlKSWcgWbWPXTAN4+K5+g==
X-IsSubscribed: yes

On 2018-01-03 10:31, David Karr wrote:
> If I have a text file that has a line that ends with "abc", and I try to grep
> for "abc$", it doesn't match. I find that it does match "$" and "abc^M$".
> I've read some of the documentation about line endings in Cygwin.
> I need to write some scripting that works on both Cygwin and Linux.
> What do I need to do here?

Use grep '...[[:cntrl:]]\?$' to match, d2u|dos2unix or sed 's/\r$//' to remove.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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

- Raw text -


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