I have a given file text below:
aatgcacatgttgcatatcaagtggatatgggtggtggaaaactgtataatggccaagcc
aatttccgtttattatttgacccaactcaagcagtagctattccgagtagcgaatttcca
I am trying to find a grep
and word count wc
command that allows me to find and then count all the "a" and "g" in the file text.
I have previously tried using
egrep 'a|g' outputSequence.txt|wc -c
I am using 'a|g'
from: https://unix.stackexchange.com/questions/37313/how-do-i-grep-for-multiple-patterns-with-pattern-having-a-pipe-character
I have tried using:
grep -o 'a|g' outputSequence.txt|wc -l
The code:
grep -o 'a|g' outputSequence.txt|wc -l
outputs 0.
I cannot find a resource that allows me to grep and word count both a and g in each line.