Get count on different fields along the raws in a file

Dear All,

Please help me to do this.

I have a file like this.

5|94662240807|94776109911|94776325901|94779007172||||||
5|94112925421|94352240384|94352259199|94672229012||||||
5|94714242745|94722952461|94777660793|94788914465||||||
5|94242224624|94776145420|94776172499|94776531059||||||

so i want to get the count on 9477 number as result from each raw.

result

3
0
1
3

Thanks,
Nayanajith.

Which language : Shell, Perl, Awk, ... ? :confused:

shell .. (bash)

nawk '{print gsub("9477", "")}' myFile.txt

#! /usr/bin/ksh
while read line
do
echo $line |awk -F"9477" '{print NF-1}'
done < file

Or:

awk '{print NF-1}' FS=9477 filename

(use nawk or /usr/xpg4/bin/awk on Solaris)

the best solution

Thanks for all replying me.All answers that i got , i have tried it's working.

Thanks you again.