So far I have this
awk '/^>/{s=++d".fasta"} {print > s}' file.fasta
This splits the file just as I want it, but it produces new files called 1.fasta, 2.fasta, 3.fasta and so on. Is there a method of splitting it that has the new file name as the ID of the sequence inside?
Or failing that, is there a quick way of renaming fasta's based on their ID?
Thanks, this is good. I want to use this in combination with a find command, could you tell me why this isn't working?
What is not working? Did you make a real directory to replace
outRoot
?Hi, yes I did make a more suitable directory! Just didn't include it because the name is sensitive. I meant just looking at the loop, It's so simple but It just doesn't work.
You need to include the trailing
/
after the directory name for this to work right. Try this.