GNU bug report logs - #31537
Combining -v and -A/-B/-C options

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Severity: wishlist; Reported by: "Garreau\, Alexandre" <galex-713@HIDDEN>; Keywords: notabug; dated Sun, 20 May 2018 01:58:02 UTC; Maintainer for grep is bug-grep@HIDDEN.
Added tag(s) notabug. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 31537 <at> debbugs.gnu.org:


Received: (at 31537) by debbugs.gnu.org; 21 May 2018 06:42:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 21 02:42:47 2018
Received: from localhost ([127.0.0.1]:42403 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fKeWt-0002ru-KV
	for submit <at> debbugs.gnu.org; Mon, 21 May 2018 02:42:47 -0400
Received: from [89.234.186.82] (port=44778 helo=galex-713.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <galex-713@HIDDEN>) id 1fKeWs-0002rm-3m
 for 31537 <at> debbugs.gnu.org; Mon, 21 May 2018 02:42:46 -0400
Received: from [::1] (helo=PC713)
 by galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <galex-713@HIDDEN>)
 id 1fKeWo-0008Gm-KB; Mon, 21 May 2018 08:42:42 +0200
From: "Garreau\, Alexandre" <galex-713@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#31537: Combining -v and -A/-B/-C options
References: <5inf21x35mjn.xl4.xxuns.g6.gal@HIDDEN>
 <98464d15-2b9c-1635-04c4-cc3f5ce70979@HIDDEN>
User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (x86_64-pc-linux-gnu)
X-GPG-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F
X-Accept-Language: fr, en, it, eo
Date: Mon, 21 May 2018 08:42:42 +0200
Message-ID: <vwv4379r0ljn.xdx.xxuns.g6.gal@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Le 20/05/2018 à 18h03, Paul Eggert a écrit : > Garreau,
   Alexandre wrote: >> I believe context options used in conjonction with invert-match
    option >> should specify which lines*not to show* along with matched then
    not >> shown lines. > > I can see it the other way. For example, "show all
    lines that lack > signed integers, plus their context" can be done via a
   command like > "grep -C1 -v -E > '[-+][0-9]+([^.e]|$)'", and I don't see any
    easy way to do the same > search under the changes you're proposing. [...]
    
 
 Content analysis details:   (1.3 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.3 RDNS_NONE              Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 31537
Cc: 31537 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Le 20/05/2018 =C3=A0 18h03, Paul Eggert a =C3=A9crit=C2=A0:
> Garreau, Alexandre wrote:
>> I believe context options used in conjonction with invert-match option
>> should specify which lines*not to show*  along with matched then not
>> shown lines.
>
> I can see it the other way. For example, "show all lines that lack
> signed integers, plus their context" can be done via a command like
> "grep -C1 -v -E=20
> '[-+][0-9]+([^.e]|$)'", and I don't see any easy way to do the same
> search under the changes you're proposing.

Oh in fact, I didn=E2=80=99t notice it actually had this effect=E2=80=A6 in=
 fact when
only a few lines don=E2=80=99t match, especially when they=E2=80=99re not c=
ontiguous,
using -v with context options nearly equals not using grep at all=E2=80=A6 =
turns
out I narrowed enough my mind to miss this.

> In essence you're proposing a new feature that I'd call "negative
> context"; i.e., if a line is not selected, then suppress the output of
> nearby lines that are selected. grep already has a lot of features and
> it's not clear this one is important enough to add.

My memory is bad, but grepping at looking at my history for when I made
up this example says me I needed this feature for something like this:

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=apt.sh
Content-Description: suppressing through grep all library packages and their
 (normally
 2 lines) descriptions afterwards

apt search programming ant | grep -v '^lib' -A 2 | less

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Here I guess we=E2=80=99re in a case where sed would be better suited=E2=80=
=A6 like a
bunch of today=E2=80=99s features of grep (invert-match, personally I belie=
ve it
would naturally be handy with it): they both come from ed
after all. But this seems to be, as coincidently said today on #emacs
(and later outside I heard [1]), a case of:

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline; filename=opposite.log
Content-Transfer-Encoding: quoted-printable
Content-Description: Portion of discussion on #emacs

[CEST]
[03:16:37] <JordiGH> Don't you love it when you have commands like
[03:16:54] <JordiGH> do_the_thing --nope-this-option-makes-me-do-the-opposi=
te-of-the-thing
[03:17:00] <JordiGH> Currently thinking of
[03:17:07] <JordiGH> ssh-keygen -R
[03:17:13] <chu> It's the Unix way
[03:17:14] <JordiGH> That -R makes it delete a key instead of generating on=
e.
[03:17:55] <twb> ssh-keygen is a random grab-bag utility that does lots of =
things, and yes, it's dumb
[03:18:13] <JordiGH> It's the git way.
[03:19:16] <JordiGH> sort --random-sort
[=E2=80=A6]
[03:19:24] <JordiGH> Isn't that, like, the opposite of sorting?
[PS=C2=A0: JordiGH agreed to be quoted in pm, and before that]
[06:37:04] <galex-713> twb: can I quote you too?
[06:38:11] <galex-713> chu: what about you then, too?
[06:38:41] <twb> galex-713: sure, you can quote that
[08:20:01] <chu> galex-713: it's fine

--=-=-=
Content-Type: text/plain


>> maybe this behavior could be triggered only
>> if the context option were specified *after* the invert-match one
>
> I'd prefer option order to not matter, at least when options do not
> simply override each other (as is the case here).

Agree, would add more complexity of use. And keywords are made to get
rid of order considerations anyway.

[1] Unix options that make commands do the opposite of their name: <https://mathstodon.xyz/@JordiGH/100064804426272107>

--=-=-=--




Information forwarded to bug-grep@HIDDEN:
bug#31537; Package grep. Full text available.

Message received at 31537 <at> debbugs.gnu.org:


Received: (at 31537) by debbugs.gnu.org; 21 May 2018 01:03:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 20 21:03:15 2018
Received: from localhost ([127.0.0.1]:42295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fKZEI-0002T3-NN
	for submit <at> debbugs.gnu.org; Sun, 20 May 2018 21:03:14 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:33264)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1fKZEG-0002Sl-Lp
 for 31537 <at> debbugs.gnu.org; Sun, 20 May 2018 21:03:13 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 33BD3160522;
 Sun, 20 May 2018 18:03:06 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id I4f_0vISfNpr; Sun, 20 May 2018 18:03:05 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 70235160527;
 Sun, 20 May 2018 18:03:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id ss1j8edmXp7S; Sun, 20 May 2018 18:03:05 -0700 (PDT)
Received: from [192.168.1.9] (unknown [47.154.30.119])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 30116160522;
 Sun, 20 May 2018 18:03:05 -0700 (PDT)
Subject: Re: bug#31537: Combining -v and -A/-B/-C options
To: "Garreau, Alexandre" <galex-713@HIDDEN>, 31537 <at> debbugs.gnu.org
References: <5inf21x35mjn.xl4.xxuns.g6.gal@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Openpgp: preference=signencrypt
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9
 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS
 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl
 KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6Pr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JXgU9Bzkk85UGbPEd7HGF
 /VSeHCQwWou6jqUDTSDvn9YhNTdG0KXPM74aC+xr2Zow1O2mhXihgWKD0Dw+0LYPnUOsQ0KO
 FxHXXYHmRrS1OZPU59BLvc+TRhIhafSHKLwbXK+6ckkxBx6h8z5ccpG0Qs4bFhdFYnFrEieD
 LoGmnE2YLhdV6swJ9VNCS6pLiEohT3fm7aXm15tZOIyzMZhHRSAPblXxQ0ZSWjq8oRrcYNFx
 c4W1URpAkBCOYJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc
 XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu
 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB
 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0
 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b
 uNcby4U=
Organization: UCLA Computer Science Department
Message-ID: <98464d15-2b9c-1635-04c4-cc3f5ce70979@HIDDEN>
Date: Sun, 20 May 2018 18:03:04 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <5inf21x35mjn.xl4.xxuns.g6.gal@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 31537
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Garreau, Alexandre wrote:
> I believe context options used in conjonction with invert-match option
> should specify which lines*not to show*  along with matched then not
> shown lines.

I can see it the other way. For example, "show all lines that lack signed=
=20
integers, plus their context" can be done via a command like "grep -C1 -v=
 -E=20
'[-+][0-9]+([^.e]|$)'", and I don't see any easy way to do the same searc=
h under=20
the changes you're proposing.

In essence you're proposing a new feature that I'd call "negative context=
";=20
i.e., if a line is not selected, then suppress the output of nearby lines=
 that=20
are selected. grep already has a lot of features and it's not clear this =
one is=20
important enough to add.

> maybe this behavior could be triggered only
> if the context option were specified *after* the invert-match one

I'd prefer option order to not matter, at least when options do not simpl=
y=20
override each other (as is the case here).




Information forwarded to bug-grep@HIDDEN:
bug#31537; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 May 2018 01:57:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 19 21:57:13 2018
Received: from localhost ([127.0.0.1]:41488 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fKDay-0007yo-81
	for submit <at> debbugs.gnu.org; Sat, 19 May 2018 21:57:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54275)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <galex-713@HIDDEN>) id 1fKDaw-0007yb-5K
 for submit <at> debbugs.gnu.org; Sat, 19 May 2018 21:57:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <galex-713@HIDDEN>) id 1fKDaq-00026r-7y
 for submit <at> debbugs.gnu.org; Sat, 19 May 2018 21:57:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:39509)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <galex-713@HIDDEN>)
 id 1fKDaq-00026l-3U
 for submit <at> debbugs.gnu.org; Sat, 19 May 2018 21:57:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45246)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <galex-713@HIDDEN>) id 1fKDao-0000q1-Sn
 for bug-grep@HIDDEN; Sat, 19 May 2018 21:57:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <galex-713@HIDDEN>) id 1fKDao-00026D-24
 for bug-grep@HIDDEN; Sat, 19 May 2018 21:57:02 -0400
Received: from [2a00:5884:8305::1] (port=53732 helo=galex-713.eu)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <galex-713@HIDDEN>)
 id 1fKDan-00025F-MG
 for bug-grep@HIDDEN; Sat, 19 May 2018 21:57:01 -0400
Received: from [::1] (helo=PC713)
 by galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <galex-713@HIDDEN>)
 id 1fKCwq-0004RJ-09
 for bug-grep@HIDDEN; Sun, 20 May 2018 03:15:44 +0200
From: "Garreau\, Alexandre" <galex-713@HIDDEN>
To: bug-grep@HIDDEN
Subject: Combining -v and -A/-B/-C options
User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (x86_64-pc-linux-gnu)
X-GPG-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F
X-Accept-Language: fr, en, it, eo
Date: Sun, 20 May 2018 03:15:43 +0200
Message-ID: <5inf21x35mjn.xl4.xxuns.g6.gal@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

It seems using a context option (-A (after-), -B (before-) or -C
(context)) when -v (invert-match) is in use just do nothing as well as
disabling the later.  I don=E2=80=99t see the utility of this behavior, as =
well
as I didn=E2=80=99t see it documented anywhere in the description of any of
these options.

I believe context options used in conjonction with invert-match option
should specify which lines *not to show* along with matched then not
shown lines.

For instance, while this command:

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=without-2.sh
Content-Description: does show the list of numbers going from 1 to 100,
 without those ending with =?utf-8?B?4oCcMuKAnQ==?= in base 10

seq 1 100 | grep -v '2$'

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

does show the list of numbers going from 1 to 100, without those ending
with =E2=80=9C2=E2=80=9D in base 10, this one:

--=-=-=
Content-Type: text/x-sh
Content-Disposition: inline; filename=without-2-and-3.sh
Content-Description: does show the list of numbers going from 1 to 100,
 without those ending with either =?utf-8?B?4oCcMuKAnQ==?= or
 =?utf-8?B?4oCcM+KAnQ==?= in base 10

seq 1 100 | grep -v '2$' -A 1

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

should also hide the lines ending with =E2=80=9C3=E2=80=9D because they sys=
tematically
follow those ending with =E2=80=9C2=E2=80=9D (currently it just show all th=
e numbers
from 1 to 100).

I didn=E2=80=99t look at if grep does act differently according the order
options are given, but if so maybe this behavior could be triggered only
if the context option were specified *after* the invert-match one?

Thank you for any attention!

--=-=-=--




Acknowledgement sent to "Garreau\, Alexandre" <galex-713@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#31537; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 1 Jan 2020 07:45:02 UTC

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