buggrep - Bugs: bug #28588, -m breaks -A

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #28588: -m breaks -A

Submitter:  Markus Jochim <angus>
Submitted:  Wed 13 Jan 2010 10:52:50 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Sat 25 Mar 2017 04:32:13 PM UTC, comment #4: 

I've moved this discussion to the debbugs-based tracker with https://debbugs.gnu.org/26254. Please send any replies to -email is unavailable-

For the record, my original reply in 2010 is here:
https://lists.gnu.org/archive/html/bug-grep/2010-02/msg00002.html

Jim Meyering <meyering>
Group administrator
Sat 25 Mar 2017 07:12:28 AM UTC, comment #3: 

I just ran into this, trying to grep for the start of a problem in a 60 Gb syslog. :-(

Context must always be printed; the current behaviour is unexpected, surprising, and counter-intuitive, says the lifetime unified diff user.

$ grep --version
grep (GNU grep) 2.16
$ lsb_release -a
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Stuart MacDonald <studog>
Thu 24 Jul 2014 07:31:12 AM UTC, comment #2: 

This also affects -m1 -C5, very annoying.

Kevin Brubeck Unhammer <unhammer>
Sat 06 Feb 2010 01:36:04 PM UTC, comment #1: 

I replied on the mailing list:

http://thread.gmane.org/gmane.comp.gnu.grep.bugs/2237/focus=2244

If you have feedback, please follow up there.

Jim Meyering <meyering>
Group administrator
Wed 13 Jan 2010 10:52:50 AM UTC, original submission:  

GNU grep 2.5.4 - Archlinux - zsh

I've created a sample input file to show the bug I've encountered in GNU grep.

sample.input:
attention
this is the first
while this looks like the second
and this smells of third
attention
fourth

Doing `grep -m 1 attention sample.input` behaves as expected. Just so do `grep -m 1 -A {1,2,3} attention sample.input`. But as soon as I increase the lines of trailing context to four or more, grep will crop the output.

$ grep -m 1 -A 5 attention sample.input
attention
this is the first
while this looks like the second
and this smells of third

Apparently, any non-first (for -m 1) occurence of the pattern is dropped even though it is part of the "five lines of trailing context" and must therefore be displayed.

I'd love to see this fixed,

Markus Jochim

Markus Jochim <angus>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by studog (Posted a comment)
  • -email is unavailable- added by unhammer
  • -email is unavailable- added by unhammer (Posted a comment)
  • -email is unavailable- added by meyering (Posted a comment)
  • -email is unavailable- added by angus (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-07-24 unhammer Carbon-Copy- Added unhammer
    2010-02-06 meyering StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code