[Bug 396237] Re: grep -Ax -q should print context but not matching line

Ma Xiaojun damage3025 at gmail.com
Thu Jun 6 14:05:31 UTC 2013


I can understand the issue. And I've verified that grep still works in
the same way in its 2.14 version.

But if you check grep(1), you will see that the current behavior is in
line with definition of -q.

http://manpages.ubuntu.com/manpages/raring/en/man1/grep.1.html

Maybe you can request grep upstream for the feature you want.

** Changed in: grep (Ubuntu)
       Status: New => Opinion

** Changed in: grep (Ubuntu)
       Status: Opinion => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grep in Ubuntu.
https://bugs.launchpad.net/bugs/396237

Title:
  grep -Ax -q should print context but not matching line

Status in “grep” package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: grep
  Version: 2.5.3~dfsg-6ubuntu1

  It would occasionally be useful to be able to output *only* the lines
  immediately before or after the matching lines, without printing the
  matching lines themselves. The logical way to do this would be to use
  e.g. grep -A1 -q (since -A1 adds the line after the match and -q
  suppresses normal output). But this doesn't work; instead there is no
  output.

  Steps to reproduce:
  1. Create a file test.txt whose contents are:
  the
  quick
  brown
  fox
  the
  lazy
  dog

  2. grep -A1 -q the test.txt

  Expected output:
  quick
  lazy

  Actual output: nothing.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/396237/+subscriptions




More information about the foundations-bugs mailing list