Re:Being Ridiculed for My Open Source Project (2013)
by IshKebab on Monday November 07, 2022 @09:40AM
(#33506316)
> unless I'm missing something?
Yes.
$ echo aaaaaa | grep -c a
1
Re:Being Ridiculed for My Open Source Project (2013)
by NateEag on Monday November 07, 2022 @12:40PM
(#33509188)
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.
Half a second, unless I'm missing something?
No objections at all to people building simpler UIs for common tasks. The classic Unix tools are like table saws without labels or safety features - confusing and rightfully intimidating. You have to read the manual carefully to avoid chopping off digits.
... but they're also like table saws in that once you know them well and are comfortable with the usage patterns that protect you from the dangerous parts, they let you achieve things with a minimum of fuss and ceremony.