|
Count lowercase in a word
I have a file like:
aabbccddDDCCDDCCaabbcc 123
CCaaCCBBCCaaaaaaaCCCaa 234
CCDDCCAACCCCccccccccaa 999
I'd like to print out the 1st word followed by the number of lowercase characters in that word. The words only consist of a few letters.
I was trying something like
awk '{a+=gsub(a,a) b+=gsub(b,b) c+=gusb(c,c) d+=(gsub(
d,d) x=(a+b+c+d) END {print $1, X}' infile >outfile
Thanks so much for your help.
|