I need to count - in bash - the number of a given (single byte) character in a file. For example: count the number of commas, or dots or uppercase 'C' or... any other character.
Basically I need a generalized version of wc -l
to count any single byte character (not just new lines) contained in a certain file.
I have to use it with very large files (several GB) so it has to be fast and resource efficient. Ideally the same level of performances you have with wc -l
if you had to count new-lines.