Hi

I have a folder with 4000 files in it. I would like make a new folder, and copy into it all of the files which contain >50 fasta sequences. How do I do this?

I know that I need to create a simple loop, then  grep '>'  | wc -l and select only those with >50. But I am new to programming and am unsure how to write this properly. 
loop over the files in DIR1,
use awk to print the files having more than 50 fasta sequences,
read and copy those files

    $ ls DIR1/*.fa | while read F; do  awk '/^>/ {N++;} END {if(N>50) printf("%s\n",FILENAME);}' "${F}" | while read F2; do cp "$F2" DIR2 ; done ; done

