public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: cyg Simple <cygsimple@gmail.com>
To: cygwin@cygwin.com
Subject: Re: grep 3.0-2 not stripping CRs on Windows
Date: Mon, 17 Dec 2018 15:38:00 -0000	[thread overview]
Message-ID: <ff0dc09c-afcb-aba9-cf11-c74a9c3e77cb@gmail.com> (raw)
In-Reply-To: <5c179f2c.1c69fb81.64a2a.1b89@mx.google.com>

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

  reply	other threads:[~2018-12-17 15:38 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
2018-12-17 15:38       ` cyg Simple [this message]
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=ff0dc09c-afcb-aba9-cf11-c74a9c3e77cb@gmail.com \
    --to=cygsimple@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).