public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [ANNOUNCEMENT] Updated [test]: grep-3.0-2
@ 2017-02-14 16:20 Eric Blake (cygwin)
  2017-02-16  4:25 ` Steven Penny
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake (cygwin) @ 2017-02-14 16:20 UTC (permalink / raw)
  To: cygwin

A new test release of grep, 3.0-2, has been uploaded and will soon reach
a mirror near you; leaving the current version at 3.0-1.

NEWS:
=====
This build modifies the behavior of grep to no longer force text mode on
binary-mounted file descriptors.  Since this includes pipelines by
default, this means that if you pipe text data through a pipeline (such
as the output of a windows program), you may need to insert a call to
d2u to sanitize your input before passing it to grep.  The impact of the
options 'grep -u' and 'grep -U' is now limited to just text-mounted file
descriptors.  These changes match what is being done in the experimental
sed-4.4-1 and gawk-4.1.4-3.  Presumably, all three programs will be
promoted to current once we decide if the policy of behaving more like
Linux on carriage returns in a binary mount makes sense.

For more details on grep, see the documentation in /usr/share/doc/grep/.

DESCRIPTION:
============
GNU Grep searches one or more input files for lines containing a match
to a specified patter.  By default, Grep outputs the matching lines.
The GNU implementation includes several useful extensions over POSIX.

UPDATE:
=======
To update your installation, click on the "Install Cygwin now" link on
the http://cygwin.com/ web page.  This downloads setup.exe to your
system. Save it and run setup, answer the questions and pick up 'grep'
in the 'Base' category (it should already be selected).

DOWNLOAD:
=========
Note that downloads from cygwin.com aren't allowed due to bandwidth
limitations.  This means that you will need to find a mirror which has
this update, please choose the one nearest to you:
http://cygwin.com/mirrors.html

QUESTIONS:
==========
If you want to make a point or ask a question the Cygwin mailing list is
the appropriate place.

-- 
Eric Blake
volunteer cygwin grep package maintainer

For more details on this list (including unsubscription), see:
http://sourceware.org/lists.html

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
  2017-02-14 16:20 [ANNOUNCEMENT] Updated [test]: grep-3.0-2 Eric Blake (cygwin)
@ 2017-02-16  4:25 ` Steven Penny
  2017-02-16  6:17   ` Brian Inglis
  2017-02-17 16:43   ` cyg Simple
  0 siblings, 2 replies; 6+ messages in thread
From: Steven Penny @ 2017-02-16  4:25 UTC (permalink / raw)
  To: cygwin

On Tue, 14 Feb 2017 10:17:25, "Eric Blake (cygwin)" wrote:
> This build modifies the behavior of grep to no longer force text mode on
> binary-mounted file descriptors.

Works, thanks:

    $ printf 'hello world\r\n' | grep . | od -tcx1
    0000000   h   e   l   l   o       w   o   r   l   d  \r  \n
             68  65  6c  6c  6f  20  77  6f  72  6c  64  0d  0a

> Since this includes pipelines by default, this means that if you pipe text
> data through a pipeline (such as the output of a windows program), you may
> need to insert a call to d2u to sanitize your input before passing it to grep.

This is certainly a good way to do it, but for more portable solution use tr:

    $ printf 'hello world\r\n' | tr -d '\r' | od -tcx1
    0000000   h   e   l   l   o       w   o   r   l   d  \n
             68  65  6c  6c  6f  20  77  6f  72  6c  64  0a


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
  2017-02-16  4:25 ` Steven Penny
@ 2017-02-16  6:17   ` Brian Inglis
  2017-02-17 16:43   ` cyg Simple
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2017-02-16  6:17 UTC (permalink / raw)
  To: cygwin

On 2017-02-15 21:25, Steven Penny wrote:
> On Tue, 14 Feb 2017 10:17:25, "Eric Blake (cygwin)" wrote:
>> This build modifies the behavior of grep to no longer force text
>> mode on binary-mounted file descriptors.
> Works, thanks:
>     $ printf 'hello world\r\n' | grep . | od -tcx1
>     0000000   h   e   l   l   o       w   o   r   l   d  \r  \n
>              68  65  6c  6c  6f  20  77  6f  72  6c  64  0d  0a
>> Since this includes pipelines by default, this means that if you
>> pipe text data through a pipeline (such as the output of a windows
>> program), you may need to insert a call to d2u to sanitize your
>> input before passing it to grep.
> This is certainly a good way to do it, but for more portable solution
> use tr:
>     $ printf 'hello world\r\n' | tr -d '\r' | od -tcx1
>     0000000   h   e   l   l   o       w   o   r   l   d  \n
>              68  65  6c  6c  6f  20  77  6f  72  6c  64  0a

Until you hit Windows text files using <line>\r<overprint>\r\n [grumble], 
when sed is better: ...| sed 's/\r$//' |... or to remove bold/highlight 
doubled line overprint only: ...| sed 's/^\([^\r]*\)\r\1$/\1/'|...

Handling overprinted underlining, selective bold/highlight, or merging 
overprinted lines, is out of scope or an exercise for the reader. ;^>

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
  2017-02-16  4:25 ` Steven Penny
  2017-02-16  6:17   ` Brian Inglis
@ 2017-02-17 16:43   ` cyg Simple
  2017-02-17 23:42     ` Steven Penny
  1 sibling, 1 reply; 6+ messages in thread
From: cyg Simple @ 2017-02-17 16:43 UTC (permalink / raw)
  To: cygwin

On 2/15/2017 11:25 PM, Steven Penny wrote:
>> Since this includes pipelines by default, this means that if you pipe text
>> data through a pipeline (such as the output of a windows program), you may
>> need to insert a call to d2u to sanitize your input before passing it to grep.
> 
> This is certainly a good way to do it, but for more portable solution use tr:
> 

There are as many ways to remove the \r as there are ways to create
them. By stating this you've convoluted the point Eric was trying to
make which was more a caution than a way to get rid of unexpected data.
You could use d2u, tr, sed, vi, foo, bar, baz, etc.  It doesn't matter
what you use to rid your piped process of excess data as long as the
excess data is removed.  Certainly portability should be a concern if
you're distributing the process or using differing systems with the same
process but we're talking about a Windows only type of issue since the
processes on *NIX will never return \r\n without some planned reason to
do so.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
  2017-02-17 16:43   ` cyg Simple
@ 2017-02-17 23:42     ` Steven Penny
  2017-02-18 13:00       ` Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Penny @ 2017-02-17 23:42 UTC (permalink / raw)
  To: cygwin

On Fri, 17 Feb 2017 11:43:13, cyg Simple wrote:
> There are as many ways to remove the \r as there are ways to create
> them.

Not really, if you are interested in POSIX compliance. POSIX Sed does not
support \r or \xD or \15. Same for POSIX Vim. The only portable tools I know are
awk and tr.

As I said before, d2u is certainly a good tool for this, but it is not portable
and some people do care about that.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
  2017-02-17 23:42     ` Steven Penny
@ 2017-02-18 13:00       ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2017-02-18 13:00 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

On 02/17/2017 05:42 PM, Steven Penny wrote:
> On Fri, 17 Feb 2017 11:43:13, cyg Simple wrote:
>> There are as many ways to remove the \r as there are ways to create
>> them.
> 
> Not really, if you are interested in POSIX compliance. POSIX Sed does not
> support \r or \xD or \15. Same for POSIX Vim. The only portable tools I
> know are
> awk and tr.

And tr can only remove ALL \r; if all you want to do is convert \r\n
line endings to \n while preserving mid-line embedded \r, you're stuck
with awk or d2u.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-18 13:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 16:20 [ANNOUNCEMENT] Updated [test]: grep-3.0-2 Eric Blake (cygwin)
2017-02-16  4:25 ` Steven Penny
2017-02-16  6:17   ` Brian Inglis
2017-02-17 16:43   ` cyg Simple
2017-02-17 23:42     ` Steven Penny
2017-02-18 13:00       ` Eric Blake

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