Separate multiple sequence into different file, one sequence per file I have a file contain multiple sequence, and I want to separate them by "gene:" into different file.
example: 


example.fa

&gt;KQK21959
ATGGTGCTCGACCCCGTCGTCGGGGGCTCGGCCTCCCGCAAGGTCGAGCCCCTAACCCTA

&gt;KQK14546
ATGCCTCCGCCGGACGCGGCCACCTACGCTCCCACGCTGCCAATGGCGACGTACCTCCCA



how to get results like this? one sequence per file, and after ">" is gene id, not cds id



KQK21959.fa

    &gt;KQK21959
    ATGGTGCTCGACCCCGTCGTCGGGGGCTCGGCCTCCCGCAAGGTCGAGCCCCTAACCCTA


KQK14546.fa

    &gt;KQK14546
    ATGCCTCCGCCGGACGCGGCCACCTACGCTCCCACGCTGCCAATGGCGACGTACCTCCCA
There's an app for that! The exonerate package (see here) includes a nice fastaexplode command that does exactly what you're looking for and will be much, much faster than anything we give you here since it is written in C and not a scripting language. Just install exonerate (you can do that with sudo apt install exonerate on Debian-based systems) and then:

fastaexplode file.fa


This will create these two files (file.fa is the original input file from your question):

$ ls
file.fa  KQK14546.fa  KQK21959.fa