From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81313 invoked by alias); 16 Feb 2017 06:17:02 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 81278 invoked by uid 89); 16 Feb 2017 06:17:00 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Feb 2017 06:16:58 +0000 Received: from [192.168.1.100] ([174.0.238.184]) by shaw.ca with SMTP id eFN9cy4LAsa1keFNAcSSWo; Wed, 15 Feb 2017 23:16:57 -0700 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: <58a5299d.26149d0a.a2c17.d033@mx.google.com> To: cygwin@cygwin.com From: Brian Inglis Reply-To: Brian.Inglis@SystematicSw.ab.ca Message-ID: <451c47cd-3fef-0e70-8698-b8033a9e69f8@SystematicSw.ab.ca> Date: Thu, 16 Feb 2017 06:17:00 -0000 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfEQfR/hPOwjZgUBaCp0U8EZH5wmfmK0zxX01gA7jLjrPIc609ld9DnYvBgAUhQIl6ocs7BoECBdfCOgJjS5Bo57d21kqgWmBd/lMPQ/yltmhmErJxZoN lfy6/JrVJr+IIlV71oI6vXZbsFgkDG0miQyxjThRGwAxFJCo24JTd8nXbaPAwGCL3IDWldGPAsPYrA== X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00206.txt.bz2 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 \r\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