public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Steven Penny <svnpenn@gmail.com>
To: cygwin@cygwin.com
Subject: Re: grep 3.0-2 not stripping CRs on Windows
Date: Mon, 17 Dec 2018 13:05:00 -0000	[thread overview]
Message-ID: <5c179f2c.1c69fb81.64a2a.1b89@mx.google.com> (raw)
In-Reply-To: <35FC3865-8891-4058-86DF-DA5F1DEFAFD4@isc.org>

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:

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$'
    alpha
    beta


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

  parent reply	other threads:[~2018-12-17 13:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 11:55 Ondřej Surý
2018-12-17 12:04 ` Soegtrop, Michael
2018-12-17 12:22   ` Ondřej Surý
2018-12-17 12:51     ` Soegtrop, Michael
2018-12-17 13:05     ` Steven Penny [this message]
2018-12-17 15:38       ` cyg Simple
2018-12-17 12:09 ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2018-12-17 11:10 Ondřej Surý
2018-12-17 11:41 ` Marco Atzeri
2018-12-17 23:37 ` Andrey Repin

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=5c179f2c.1c69fb81.64a2a.1b89@mx.google.com \
    --to=svnpenn@gmail.com \
    --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).