-2

I have a text file that have the following structure:

>RF1CLC1
DATADATADATADATA
>RF1CLC2
DATADATADATADATA
DATADATADATADATA
DATADATADATADATA
>RF2CLC13
DATADATADATADATA
>RF2CLC24
DATADATADATADATA
DATADATADATADATA

and so on.

I'm looking for a way to add a suffix "_c1_g1_i1" at the end of the line containing ">", resulting in:

>RF1CLC1_c1_g1_i1
DATADATADATADATA
>RF1CLC2_c1_g1_i1
DATADATADATADATA
DATADATADATADATA
DATADATADATADATA
>RF2CLC13_c1_g1_i1
DATADATADATADATA
>RF2CLC24_c1_g1_i1
DATADATADATADATA
DATADATADATADATA

awk, sed or perl/python solution is preferred.

Thanks in advance!

1 Answers1

0

I was trying with sed -i "/>/ s/$)/)_c1_g1_i1/g" TEST.fasta but thanks to roelofs I realized that the syntax was wrong.

Used

sed -i '/>/ s/$/_c1_g1_i1/' TEST.fasta

and worked out well.

Thanks.