bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible grep bug


From: Sandro Bosio
Subject: Possible grep bug
Date: Wed, 25 May 2005 13:41:01 +0200 (CEST)

Hello!

I'm using grep (GNU grep) 2.5.1. The problem is the following:

Suppose there is a file "file.in" containing:

A
B
C
D
E

"grep C -A 1 file.in" results (correctly) in

C
D

while adding a -v option,so that one (or at least me) expects all the lines but those printed before, prints the whole file.

That is probably because first -v is applied and then -A 1 extends the non-matching, while my expected result was first apply the rules, decide if you should print the line AND THEN revert the result.

Maybe it is not a bug at all, maybe it's just a subtle difference in "matching" lines and "printed" lines. Anyway I think that people expect as a standard behaviour, when using -v and options -A or -B, to not print a given number of lines when a match is found, and not instead printing a given number of lines when a non-match is found.

Thanks!
Sandro, Italy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]