I have a data that looks like this (FASTA format). Note that in comes with block of 2 ">" header and the sequence.
>SRR018006
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGN
>SRR018006
ACCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
What I want to do is to append a text (e.g. "foo" in the > header) yielding:
>SRR018006-foo
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGN
>SRR018006-foo
ACCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Is there a way to do that using SED? Preferably inline modifying the original file.
This will do what you're looking for.
sed -ie 's/^\(>.*\)/\1-foo/' file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With