3 ms·
> unless I'm missing something? Yes. $ echo aaaaaa | grep -c a 1
by IshKebab 4y ago
> unless I'm missing something?
Yes.
$ echo aaaaaa | grep -c a
1
- NateEag 4y agoAh, thanks for clarifying. I did indeed misunderstand. grep -o $pattern $filename | wc -l would work in that case, I think. I did have to think for a minute to come up with that version. It was definitely still much faster for me than writing my own matching logic would have been, but that may well be different for other people.