delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/11/17/12:31:14

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 342F4385454F
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=systematicsw.ab.ca
X-Authority-Analysis: v=2.4 cv=LM91/ba9 c=1 sm=1 tr=0 ts=63766f92
a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17
a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=IC_739QHJjyCLqWiG04A:9 a=QEXdDO2ut3YA:10
a=ZIGPnEnQmisA:10 a=vmOwH9HAGyUA:10 a=FBNtmh7_lDcA:10
a=sRI3_1zDfAgwuvI8zelB:22
Message-ID: <504897c2-4f80-7441-6156-5b3788446ba4@SystematicSw.ab.ca>
Date: Thu, 17 Nov 2022 10:29:53 -0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: --text option of grep v3.7-2 not stripping CR from EoL
To: cygwin AT cygwin DOT com
In-Reply-To: <20221115062231.qyxi5n7imx4jh4ih@math.berkeley.edu>
Organization: Systematic Software
X-CMAE-Envelope: MS4xfM4QuhWo4JN4Lz0yDFhCzvnPeMyfkNS8kYlbN/LJkHdsm/z0mBroBT9TO5DlZurFLqq3dd4lwzzT8F7kRdSuD5HGW9HxhHR+ryUyczRS1aHmyjfbZS3/
iwTdCYj8wQrlKL2JL4b+/HzQX5pXilOQQ7QCiVtBeL1kpp9QQ9Rs/xJvvpB6mfgM+l1a74AmYRqY457lxk5gOEharlg8A0r46bg=
X-Spam-Status: No, score=-1163.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 2AHHUu3c021628

On Mon, 14 Nov 2022 22:22:31 -0800, Ilya Zakharevich wrote:
> grep with -a (or --text) option does not strip CR from line ends

That has been the case for over five years, as discussed about 2017-02, decided 
and announced in utilities releases that month (gawk, grep, sed) and earlier in 
bash IIRC, to avoid corrupting files and pipeliness by doing so, and for 
compatibility with other non-Windows systems; see discussions in threads:

	https://cygwin.com/legacy-ml/cygwin/2017-02/msg00152.html
	https://cygwin.com/legacy-ml/cygwin/2017-02/msg00188.html
	https://cygwin.com/legacy-ml/cygwin/2017-02/msg00189.html

> This does not emit anything (contrary to the man page, which says:
>       If grep decides the file is a text file, it strips the CR
>       characters from the original file contents (to make regular
>       expressions with ^ and $ work correctly).

That is under -U, --binary, where it also says:

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

Cygwin does not operate as DOS nor Windows, but does offer text mounts, which 
may still strip CRs from CR-LF EoL markers in *files*.

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

La perfection est atteinte			Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter	not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer	but when there is no more to cut
			-- Antoine de Saint-Exupéry

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

- Raw text -


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