delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/02/16/01:17:15

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=eEtjxbJyioqYDMV7
GivxrdcETDMGUKfmuB5ygR1BEbchkqbWS/Z3aL30xQAV3Pg9gKG6mLgX0VwAl3sp
xH5DtfpYqpilJpVjpbiW2umwfYLr64Lr7yZy6wogYx2u/tLS009aKWlttjuyntaq
WkcVjlwJQstujJBdQ8Tgi/q/0fU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:to:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=y2A28By2xQBBTVe0eOeqZB
1lcOE=; b=uED6Hnajqm0NtcL+2WDbkbsTNNM73C3X5bIG9X8+e/g8+IrbD45gVV
nR3I1sInlPfVK0Gj/7JL0WaZZOjSf3bvGQmCF5Uw+9+0siMVKI7ZEXf4RNinU+SI
iW52mO32jNwWQ9use8S1YUuWTKkuWxlP8/OcCij4Y/in8+qs93ep4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*RU:64.59.136.137, Hx-spam-relays-external:64.59.136.137, H*R:D*ca, Hx-languages-length:1269
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=W+NIbVek c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=1NGfLQl9ltrrPbpoNvUA:9 a=QEXdDO2ut3YA:10
Subject: Re: [ANNOUNCEMENT] Updated [test]: grep-3.0-2
References: <announce DOT 1ee39b81-925c-cb2e-efe5-bd06f27a8440 AT redhat DOT com> <58a5299d DOT 26149d0a DOT a2c17 DOT d033 AT mx DOT google DOT com>
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Message-ID: <451c47cd-3fef-0e70-8698-b8033a9e69f8@SystematicSw.ab.ca>
Date: Wed, 15 Feb 2017 23:16:55 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
MIME-Version: 1.0
In-Reply-To: <58a5299d.26149d0a.a2c17.d033@mx.google.com>
X-CMAE-Envelope: MS4wfEQfR/hPOwjZgUBaCp0U8EZH5wmfmK0zxX01gA7jLjrPIc609ld9DnYvBgAUhQIl6ocs7BoECBdfCOgJjS5Bo57d21kqgWmBd/lMPQ/yltmhmErJxZoN lfy6/JrVJr+IIlV71oI6vXZbsFgkDG0miQyxjThRGwAxFJCo24JTd8nXbaPAwGCL3IDWldGPAsPYrA==
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019