www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/12/17/10:39:07

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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=Z6vNaJydeNmhFQad
2K7rP0EFDLMvOz5rkq46YLvGeqqqtUXlQ3W//hSpcIciOdxPig5T52r6X0gY/u10
/8AQOgEgsu78PaM/1yqlhotehFHxlkUEIs4BtB5Bjxht9wLjf4Ydpkqbl7G1+EFt
73PrKi284cRTBK0o67oEYYzfQWg=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=bpejdWKjwcbO8fKpH9ygXP
m4Mi0=; b=oRiEUVm1qfsvFkUlbj6ldCpXTmiK+iNAaLdsCo5O9KWnkvsG8QEU4O
fvq9AHlcTbwxUg+G65poCkpcMAJJbvPQOCOA9fbfTV0ZOsNuEDrtsqMQHEGePkIZ
RX5H40kir/89GbMNgeGJ6BuhvRf/EdKUkTUT1/AzKC3dnWWP0Hb6k=
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-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:ip*192.168.0.5, HX-Received:d4c2, HContent-Transfer-Encoding:8bit
X-HELO: mail-it1-f178.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=30JfgJRBISET9500Jbmu1LFimzOnimZhh8wlyu8ah5I=; b=nu+srGvHu2thzMgQc8h5//iaRRlpV3rPhDJl3hz/mvgKmqhy8AW6OPQ1FV03DVkI4T lAKiK+fdZAz8JDu253XF5yPf9Iwfzw4ly8GiynFKVosn3lQWTZ8bnisrYYacLZ1JARj+ YexgZ4pUnQQDW7B4yNvQlidbCB7PXJkgrQZtfmt+nbqMfh312kJ+rUM7UzcEcq2NiJdH j/RgA6jvbgaiWoJg9w7wLlF4qPRxu7KcD0vGO7Xxaozj4WEhmRBYiBol5QK2gtZXjmUg gXRnw7OcsfUHbWGH3IZYYIK8800mOhw/Fnwkv+htGLRHbSkEIBc2jLR5hwWnN/Il7lUT WoOQ==
Subject: Re: grep 3.0-2 not stripping CRs on Windows
To: cygwin AT cygwin DOT com
References: <35FC3865-8891-4058-86DF-DA5F1DEFAFD4 AT isc DOT org> <5c179f2c DOT 1c69fb81 DOT 64a2a DOT 1b89 AT mx DOT google DOT com>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <ff0dc09c-afcb-aba9-cf11-c74a9c3e77cb@gmail.com>
Date: Mon, 17 Dec 2018 10:38:49 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
MIME-Version: 1.0
In-Reply-To: <5c179f2c.1c69fb81.64a2a.1b89@mx.google.com>
X-IsSubscribed: yes

On 12/17/2018 8:05 AM, Steven Penny wrote:
> On Mon, 17 Dec 2018 13:22:48, Ondřej Surý wrote:
>> # No amount of options makes the grep find the text in the file
>> $ ./grep-3.0-2.exe 'foo$’ crlf.txt
>> $ ./grep-3.0-2.exe -U 'foo$' crlf.txt
>> $ ./grep-3.0-2.exe -a 'foo$’ crlf.txt
> 
> Your commands are failing because you are not accounding for the carriage
> returns. as was said, this change was intentionally done for the purpose of
> making scripts MORE portable:
> 

And the portability is what we want to keep.

> https://cygwin.com/ml/cygwin/2017-02/msg00155.html
> 
> if you want to keep your grep command, you need to remove CR first:
> 
>     $ printf 'alpha\r\nbeta\r\n' > CRLF.txt
>     $ tr -d '\r' < CRLF.txt | grep 'a$'

This is the POSIX method to get portability and Cygwin is POSIX for 
Windows.  Therefore the bits of documentation for MS-DOS  and MS-Windows 
isn't in affect for Cygwin grep.  In other words the following is in 
affect but can be misinterpreted because Cygwin runs on MS-Windows but 
isn't considered such.

"This option  has  no  effect  on  platforms other than MS-DOS and 
MS-Windows."

>     alpha
>     beta

-- 
cyg Simple

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