Add words at beginning and end of the same line for the FASTA header line with sed
I have the following line:
>A_1000
ACTTTCGATCTCTTGTAGATCTGTTCTC...CAC
ACTTTCGATCTCTTGTAGATCTGTTCTC...CAC
I would like to convert the first line as follows:
>INITWORD/A_1000/FINALWORD
ACTTTCGATCTCTTGTAGATCTGTTCTC...CAC
ACTTTCGATCTCTTGTAGATCTGTTCTC...CAC
I found a similar question that did allow me to append the end and the beginning as I needed (stackoverflow.com/questions/68541730/add-words-at-beginning-and-end-of-a-fasta-header-line-with-sed). However, it adds the FINALWORD to the next line.
I ran the following:
sed 's%^>(.*)%>Initialword/1/Finalword%' fasta _test.fasta > fasta_test2.fasta
Which returns:
>Initialword/A_0101M/Finalword
ACTTTCGATCTCTTGTAGATCTGTTCTC...CACM
ACTTTCGATCTCTTGTAGATCTGTTCTC...CACM
But in the Fasta file it looks like:
>Initialword/A_0101
/Finalword
ACTTTCGATCTCTTGTAGATCTGTTCTC...CAC
How can I fix this to just add the text to the beginning and end of the header? What is the M at the end of each line in the file?
Thank you
• 27 views
Read more here: Source link