counting number of pattern occurrences

Hi All,

Is it possible to count number of occurrences of a pattern in a single record using awk??

for example:
a line like this:
abrsjdfhafa

I want to count the number of a character occurrences. but still use the default RS, I don't want to set RS to single character.

To count the number of occurrences of the letter "a" you could do something like:

awk '{count=gsub("a","a")}'