How to count the occurence of a character in a line

Suppose i have data like :-

1,2,3,4,5
a,b,c
x,y,z,t

I want to count the occurence of , (comma) in every line.

Waiting for a solution.:slight_smile:

No duplicate or cross-posting, please read the rules.

Continue here:

http://www.unix.com/unix-dummies-questions-answers/91043-how-count-occurence-character-line.html\#post302262025

Thread closed.