How to replace the headers in a fasta files with same keyword?
Hi
I have thousands(1000's) of fasta files in one directory, I want to replace all the fasta file headers with the same keyword >Gast_superba ??
suggestions.
• 1,995 views
•
link
1 answer
At the risk of sounding redundant after Wayne's answer, I think you should be able to use the following command in Unix:
sed 's/>.*/>Gast_superba/' *.fasta
• 0 views
•
link
Log in to answer this question.
Do you want to add
Gast_superbain to the description line of the entries following the caret in each one and leave the rest of the previous description line? A few examples of what you have and what you want for each entry in the file would make sure you got the best advice. Because I wonder if I have it backwards, and you want to replace all those occurences with something different, similar to here.This sounds like the fastest way to do this would be to use a shell script to iterate on the FASTA files matching your extension, see here, and then use
sedto the a find/replace on the header line, see here. If I understand correctly you replace every caret with>Gast_superba.There's a lot of similar answers already in Biostars if you look around.
Replacing the header name of each fasta file (10000's) in a directory, I solved it writting a loop.
Original file
Modified file
cpad0112, thanks I solved it by writing loop.