>> `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 -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
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
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