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 #8 received at 33574 <at> debbugs.gnu.org (full text, mbox):

From: Phillip Feldman <phillip.m.feldman <at> gmail.com>
To: helen.grubner <at> fgznet.ch
Cc: 33574 <at> debbugs.gnu.org, alexander.grubner <at> fgznet.ch
Subject: Re: bug#33574: grep -c question
Date: Sun, 2 Dec 2018 00:03:11 -0800
[Message part 1 (text/plain, inline)]
`grep -c` reports the number of matching lines--not the total number of
times the pattern appears.

On Sat, Dec 1, 2018 at 11:15 PM Helen Grubner <helen.grubner <at> fgznet.ch>
wrote:

> Dear Team
>
>
>
> Can you tell me, why I see this with grep -c on a file with following
> content?
>
>
>
> $ cat file_13.txt
>
> 1
>
> 2
>
> 3
>
> 4
>
> 5
>
> 6
>
> 7
>
> 8
>
> 9
>
> 10
>
> 11
>
> 12
>
> 13
>
>
>
> $ grep -c 1 file_13.txt
>
> 5
>
>
>
> Should it not show 6? When search for value 2, it is correct.
>
>
>
> $ grep -c 3 file_13.txt
>
> 2
>
>
>
>
>
> $ file file_13.txt
>
> file_13.txt: ASCII text
>
>
>
> Thank you
>
> Alexander Grubner
>
>
>
>
[Message part 2 (text/html, inline)]

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

Previous Next


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