[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22071: incorrect behaviour for inverted matches with -l on empty fil
From: |
Eric Blake |
Subject: |
bug#22071: incorrect behaviour for inverted matches with -l on empty files |
Date: |
Wed, 2 Dec 2015 06:32:11 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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
signature.asc
Description: OpenPGP digital signature