Just to be complete
when using grep -o -c, it only counts the single lines that match i.e. it misses the double entries on the same line- You can either do the replace (echo/echo\n) or use the wc or nl to count the returned matches
I have not found any option to -c that counts all matches ? anyone else ?