public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: --text option of grep v3.7-2 not stripping CR from EoL
Date: Thu, 17 Nov 2022 10:29:53 -0700	[thread overview]
Message-ID: <504897c2-4f80-7441-6156-5b3788446ba4@SystematicSw.ab.ca> (raw)
In-Reply-To: <20221115062231.qyxi5n7imx4jh4ih@math.berkeley.edu>

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

      reply	other threads:[~2022-11-17 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  6:22 --text option of grep v3.7-2 not working Ilya Zakharevich
2022-11-17 17:29 ` Brian Inglis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504897c2-4f80-7441-6156-5b3788446ba4@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).