I have been trying to find the amount of 1s per each species in a fasta file that looks like this:
>111
1100101010
>102
1110000001
The desired output would be:
>111
5
>102
4
I know how to get the numbers of 1s in a file with:
grep -c 1 file
My problem is that I cannot find the way to keep track of the number of 1s per each species (instead of the total in the file).