Package: grep;
Reported by: "Garreau,円 Alexandre" <galex-713 <at> galex-713.eu>
Date: 2018年5月20日 01:58:02 UTC
Severity: wishlist
Tags: notabug
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Garreau,円 Alexandre" <galex-713 <at> galex-713.eu> To: bug-grep <at> gnu.org Subject: Combining -v and -A/-B/-C options Date: 2018年5月20日 03:15:43 +0200
[Message part 1 (text/plain, inline)]
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’t see the utility of this behavior, as well as I didn’t 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:
[without-2.sh (text/x-sh, inline)]
seq 1 100 | grep -v '2$'
[Message part 3 (text/plain, inline)]
does show the list of numbers going from 1 to 100, without those ending with "2" in base 10, this one:
[without-2-and-3.sh (text/x-sh, inline)]
seq 1 100 | grep -v '2$' -A 1
[Message part 5 (text/plain, inline)]
should also hide the lines ending with "3" because they systematically follow those ending with "2" (currently it just show all the numbers from 1 to 100). I didn’t 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!
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.