Hello I have a a big fasta file containing smaller files each with a unique header example:

Ssc10_2_8. I want a simple linux command to help me split the big fasta file into smaller files with their headers on these files. So after splitting I want to get something like this:

> Ssc10_2_8
agcggcctt

and

>Ssc10_2_1
tttggttcc

all in separate files.

link|improve this question
feedback

closed as off topic by MDMarra, mailq, Iain, DJ Pon3, voretaq7 Nov 11 '11 at 22:18

Questions on Server Fault are expected to generally relate to servers, networking, or desktop infrastructure, within the scope defined in the faq.

1 Answer

Try this awk command

awk '/^>/{file=++n".fasta"} {print > file}' InputFile

You may also want to have a look at this on the biostar.sx site.

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.