I am trying to count the occurrences of consonants and vowels in multiple files on Linux, but I want the number of occurrences to be separately calculated for each file. I use
awk -v FS=""'{for ( i=1;i<=NF;i++){if($i ~/[bcdfghjklmnpqrtsvwxyzBCDEFGHJKLMNPQRTSVWXYZ]/)cout_c++ ;else if ($i ~/[aeiouAEIOU]/) count_v++}}END {print FILENAME,count_v,count_c}' file1 looks like this:
bac Dfeg k87 eH tRe rt up file2 looks like this:
hi rt2w PrOt but it prints the occurrences of both files:
file2 7 19 How could I change this so the output would be like :
file1 5 12 file2 2 7
ffi), should it be counted as 2 consonants and 1 vowel?