`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.grub...@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
>
>
>
>

Reply via email to