From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78165 invoked by alias); 17 Dec 2018 15:38:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 78157 invoked by uid 89); 17 Dec 2018 15:38:56 -0000 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 Received: from mail-it1-f178.google.com (HELO mail-it1-f178.google.com) (209.85.166.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Dec 2018 15:38:55 +0000 Received: by mail-it1-f178.google.com with SMTP id c9so20571384itj.1 for ; Mon, 17 Dec 2018 07:38:54 -0800 (PST) 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== Return-Path: Received: from [192.168.0.5] (d47-69-109-131.nap.wideopenwest.com. [69.47.131.109]) by smtp.gmail.com with ESMTPSA id y23sm18808976ita.1.2018.12.17.07.38.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 07:38:52 -0800 (PST) Subject: Re: grep 3.0-2 not stripping CRs on Windows To: cygwin@cygwin.com References: <35FC3865-8891-4058-86DF-DA5F1DEFAFD4@isc.org> <5c179f2c.1c69fb81.64a2a.1b89@mx.google.com> From: cyg Simple Message-ID: Date: Mon, 17 Dec 2018 15:38:00 -0000 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00152.txt.bz2 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