2 ms·
Ah, 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
by NateEag 4y ago
Ah, 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.