grep help

I have a file that contains a number of fasta sequences, each one starts with '>'. I would like to count the number of sequences I have in the file. When I use the code below I get:

$ grep -c '>' total_Protein.txt
1

even though the file contains hundreds

If I use:

$ grep -c {>} total_Protein.txt 
$ 

It doesn't appear to do anything

$ grep -c > total_Protein.txt 

Gives me a grep usage error.

Any ideas?

Is it possible that they are all on one (newline separated) record?

What is the result of this command:

awk 'END { print NR-1 }' RS=">"  total_Protein.txt

If not what you are expecting, post a sample of your txt file.

Try this:

grep -o '>' total_Protein.txt | wc -l

Thanks spacebar, worked like a charm! :b: