I have a text file that looks like this. I would like to extract the total number of “A” and “E” characters.
>pr1
FSVSQNNPAE
>pr2
MAKERAHSQ
>pr3
RRRDKINNWIVQL
I would like to get the output like this
>pr1
Total number of A - 1
Total number of E - 1
>pr2
Total number of A – 2
Total number of E - 1
>pr3
Total number of A – 0
Total number of E – 0
How can I do this with awk?
One way. When found a line beginning with
>, read next one, save it instrvariable and count number of substitution for each letter.Output: