This is the mail archive of the
mailing list for the Cygwin project.
Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
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
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple