GNU bug report logs - #33574
grep -c question

Previous Next

Package: grep;

Reported by: "Helen Grubner" <helen.grubner <at> fgznet.ch>

Date: Sun, 2 Dec 2018 07:15:02 UTC

Severity: normal

Tags: notabug

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

Bug is archived. No further changes may be made.

Full log


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

From: Paul Jackson <pj <at> usa.net>
To: bug-grep <at> gnu.org
Subject: Re: bug#33574: grep -c question
Date: Sun, 02 Dec 2018 08:55:49 -0600
>> `grep -c` reports the number of matching lines--not the total number of
>> times the pattern appears.

Yes. 

In other words, the line "11" counts as 1 match (one line), not as two matches.

I  would expect the command "grep -c somepattern somefile" to provide the
same results as the command "grep somepattern somefile | wc -l" (each matching
line counts once.)

-- 
                Paul Jackson
                pj <at> usa.net




This bug report was last modified 5 years and 139 days ago.

Previous Next


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