Subject: Re: bug#22071: incorrect behaviour for inverted matches with -l on empty files

From: Eric Blake <[email-masked]>
Date: Wed, 2 Dec 2015 06:32:11 -0700

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