test if file is valid FASTA using grep (i.e. full file matching single regular expression)
What is a simple way to test if given file is valid FASTA:
>genename1 atgcgtcactgNNNNNactgat >genename 2 ACACTTACAGGGCTAC >genename3 ATCCaACTACGGCTGGACTTGCGGCAT
I tried the following, but it would give a match if there's at least 1 valid gene, as opposed to all of them
grep -Pli "(>.+\n[atgcn]\n+)*" valid_example.fasta
Use the -v flag to invert the match. Then check to see if any lines match.
You might want to do like
grep -qv [other options] [pattern] $file || echo $file matches