GNU bug report logs - #22071
incorrect behaviour for inverted matches with -l on empty files

Previous Next

Package: grep;

Reported by: Mark Wotton <mwotton <at> gmail.com>

Date: Tue, 1 Dec 2015 22:47:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 22071 <at> debbugs.gnu.org (full text, mbox):

From: Mark Wotton <mwotton <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: Santiago Ruano Rincón <santiagorr <at> riseup.net>,
 22071 <at> debbugs.gnu.org
Subject: Re: bug#22071: incorrect behaviour for inverted matches with -l on
 empty files
Date: Wed, 2 Dec 2015 08:57:49 -0500
Yes, I understand the interpretation now. Just confusing when you have
a model in mind that almost always works.

On 12/2/15, Eric Blake <eblake <at> redhat.com> wrote:
> On 12/02/2015 06:14 AM, Mark Wotton wrote:
>> hm. "grep -l '' empty" also doesn't print anything, so I guess it's
>> consistent, at least.
>
> You want 'grep -L "hi there" ./empty', which says to print the names of
> all files that did not contain any match (and not the names of all files
> that had lines that didn't match).  That is, -v and -L are different
> types of negation.
>
> $ grep -L '' empty
> empty
> $ grep -Lv '' empty
> empty
>
> The empty file has no matches to any patterns (whether or not the
> pattern is negated with -v), so it shows up under -L.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>


-- 
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
        -- Chris Maeda




This bug report was last modified 9 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.