GNU bug report logs - #26576
-v when used with -C

Previous Next

Package: grep;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 20 Apr 2017 14:40:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #42 received at 26576-done <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 26576-done <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#26576: -v when used with -C
Date: Fri, 21 Apr 2017 15:34:57 +0000
On Thu, Apr 20, 2017 at 02:34:47PM -0500, Eric Blake wrote:
>On 04/20/2017 11:51 AM, Assaf Gordon wrote:
>
>> If I may suggest the following sed program:
>>
>>  $ sed -n ':x 1,2{N;bx} ; /UGLY/{ N;N;z;bx }; /./P;N;D' file
>
>Works as long as lines 1 and 2 do not contain UGLY. But misbehaves if
>UGLY appears early:
[...]
>Also misbehaves if two occurrences of UGLY appear with overlapping context:
>
[...]
>May be fixable with even more magic, perhaps by using the hold buffer to
>track the status of the last three lines, and suppressing output if any
>of the last three inputs were UGLY.  But more complicated than I want to
>spend time on for the sake of this email.
>

Good catch, thanks for pointing this out.

Indeed, that was an ad-hoc script, suitible for some limited scenarios
but not robust as a general solution.

-assaf






This bug report was last modified 8 years and 35 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.