Count occurances of a character in a file

I want to find the number of occurences of a character in a file.
How do i do it.

Eg:
$cat file1.txt
Welcome to World of Unix.
$

If i want to find the occurences of 'o' then I should be getting 3.

Thanks.

echo "start with this" | awk '{ for ( i=1; i<=length; i++ ) arr[substr($0, i, 1)]++ }END{ for ( i in arr ) { print i, arr } }'

Thanks buddy,

Can you explain me where the actual conting of string happens..
I am unable to understand the script

 # awk 'BEGIN{FS=""}{array[$1]++}END{ # code to print values}' file

Extract each character and create an associative array which maps between the character and the count of character

Hi, Shivdatta.

Do you wish to count occurrences of all characters or of a specific character? ... cheers, drl

tr -cd o file1.txt | wc -c