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

Submitted by:  Markus Jochim <angus>
Submitted on:  Wed 13 Jan 2010 10:52:50 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: In Progress
Privacy: PublicAssigned 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 -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>
Project 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>
Project 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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 24 Jul 2014 07:31:12 AM UTCunhammerCarbon-Copy-=>Added unhammer
    Sat 06 Feb 2010 01:36:04 PM UTCmeyeringStatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup1