GNU bug report logs - #42245
grep -l -c does not work like expected

Previous Next

Package: grep;

Reported by: muellae <at> online.de

Date: Tue, 7 Jul 2020 14:46:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Volker Raab <muell_collect <at> raaab.de>
To: 42245 <at> debbugs.gnu.org
Subject: bug#42245: grep -l -c does not work like expected
Date: Tue, 7 Jul 2020 14:48:53 +0200
[Message part 1 (text/plain, inline)]
Hi all,


are the options "-l" and "-c" mutually incompatible?
And if so, why?

What happens:
When I enter 'grep -c search *' I get _all_ files listed with the number
of matches (many of them with appended ":0" ).
When I enter 'grep -c search *' I get a list of files which match.

But:
When I enter 'grep -l -c search *' I still get the same result as
without '-c'. (the same happens if I exchange '-l' and '-c')

What I expect:
In the latter case I would expect to get a list of all files that match
with an appended ":xxx'  where the xxx denotes the number of matches,
none of which is ":0"

Comment:
Yes, of course I can pipe the result through 'grep -v :0' but this is
clumsy and does not mend that the combination of '-l' and '-c' does not
produce the expected result.

Thanks a lot for considering this in future versions.


Best regards
		Volker



[pEpkey.asc (application/pgp-keys, attachment)]

This bug report was last modified 4 years and 267 days ago.

Previous Next


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