Hi - I know this post is quite old now, but I tried the above code for the multi-line fasta and it produced a fasta file that had only the names and then the number, but none of the sequences. I would like to add the numbers to the headers, but keeping the sequences intact in the output file - Is there any way to do this? I have been trying to resolve a makeblastdb error saying I have duplicate seqids and I was hoping this approach might resolve the error.
Edit: I tried the line from Alex Reynolds: awk '/^>/{$0=$0"_"(++i)}1' in > out
And it successfully added a number at the end of the description line, but I am trying to add the number addition directly to the end of the sequence ID number since adding it to the description didn't seem to help my error on makeblastdb.
Eg: I want: " >CP064824.1_1 Klebsiella pneumoniae subsp. pneumoniae strain K219 plasmid pIncFIB, complete sequence TGAACGTCACTGCCATCCTGCATTCTGAATGGCAGCATTATTTCTCTCTGACATCACGCCGTGCGTGTAA...." Instead of: ">CP064824.1 Klebsiella pneumoniae subsp. pneumoniae strain K219 plasmid pIncFIB, complete sequence_1 TGAACGTCACTGCCATCCTGCATTCTGAATGGCAGCATTATTTCTCTCTGACATCACGCCGTGCGTGTAA...."
Thanks!
Could you expand a bit on your post? What's the purpose of doing this?
Soory, I just want to record this. thanks for you concern, I will explain more for next time.
ZQ