This is the mail archive of the
mailing list for the Cygwin project.
Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
- From: Steven Penny <svnpenn at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 15 Feb 2017 20:25:01 -0800 (PST)
- Subject: Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org>
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.
$ 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
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple