I have a few text files and I\'d like to count how many times a letter appears in each?
Specifically, I\'d like to use the UNIX shell to do this, in the form of: cat fil
Here is another way
cat input_file | \ awk 'BEGIN {FS="x"; var=0 } \ {if (NF>0){ var=var + (NF-1) } } \ END{print var}'
where X is the character or string of characters you want to count and infile is the input file