On 08/22/2018 06:32 PM, Karl Riauba wrote:
> Hi,
>
> I think I found egrep bug.
Thanks for your report. However, you've reported to an old address;
'grep --help' currently recommends that bug reports be sent to
bug-...@gnu.org, which makes me wonder if the behavior you are seeing
may have changed in the meantime with a newer version of grep.
> No tabs in example file or in variable.
Maybe not, but your mailer line wrapped things, which means I can't
readily reproduce your output by just copying and pasting from your
email. However, I think I've managed to reconstruct the egrep_bug file
that you describe, containing just 5 lines, and your $egrep variable
with no newlines but a bunch of values with one space on either side.
> $ echo ===$egrep===
It's hard to say if I exactly matched the contents of your $egrep
variable, since you forgot to use shell quoting, so if your variable
contained multiple spaces, word splitting and then echo's argument
pasting collapsed those multiple spaces down to one.
> $ cat egrep_bug | egrep -v "$egrep"
Side comment: Useless use of cat; you could have written:
egrep -v "$egrep" < egrep_bug
for fewer processes.
When I tried to reproduce your setup, this line was filtered for me,
using grep 3.1. But it was very easy to make this line not be filtered,
by calling:
egrep -v " $egrep" < egrep_bug
since that creates a pattern which requires two leading spaces, when
only one is present in the input. Since you didn't use proper shell
quoting, I can't tell if the bug is in your usage, or if it really was
something broken in whatever version of grep you are using.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
+1-919-301-3266
Virtualization:
qemu.org |
libvirt.org