1

I would like to replace the first instance of ".*_" with a tab as follows

WP_162009627.1_hypothetical_protein_[Borreliella_burgdorferi]
AAC67153.1_translation_initiation_factor_IF-2_putative_[Borreliella_burgdorferi_B31]
AA_C67154.1_transcription_elongation_protein_NusA_[Borreliella_burgdorferi_B31]
AAC67155.1_conserved_hypothetical_protein_[Borreliella_burgdorferi_B31]
EEH32441.1_hypothetical_protein_BBU29805_0856_[Borreliella_burgdorferi_29805]
AAF07414.1_2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
AA_F07637.1_BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07415.2_borrelia_orf-D_family_(plasmid)_[Borreliella_burgdorferi_B31]
AAF_07637.1_BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07414.1_2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
PRR_07352.1_hypothetical_protein_CV677_05765_[Borreliella_burgdorferi]
EEG99465.1_conserved_hypothetical_protein_[Borreliella_burgdorferi_94a]

expected result

WP_162009627.1  hypothetical_protein_[Borreliella_burgdorferi]
AAC67153.1  translation_initiation_factor_IF-2_putative_[Borreliella_burgdorferi_B31]
AA_C67154.1 transcription_elongation_protein_NusA_[Borreliella_burgdorferi_B31]
AAC67155.1  conserved_hypothetical_protein_[Borreliella_burgdorferi_B31]
EEH32441.1  hypothetical_protein_BBU29805_0856_[Borreliella_burgdorferi_29805]
AAF07414.1  2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
AA_F07637.1 BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07415.2  borrelia_orf-D_family_(plasmid)_[Borreliella_burgdorferi_B31]
AAF_07637.1 BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07414.1  2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
PRR_07352.1 hypothetical_protein_CV677_05765_[Borreliella_burgdorferi]
EEG99465.1  conserved_hypothetical_protein_[Borreliella_burgdorferi_94a]

I tried "sed -e 's/\.[1,2]_/\t/'" but it gave me

WP_162009627    hypothetical_protein_[Borreliella_burgdorferi]
AAC67153    translation_initiation_factor_IF-2_putative_[Borreliella_burgdorferi_B31]
AA_C67154   transcription_elongation_protein_NusA_[Borreliella_burgdorferi_B31]
AAC67155    conserved_hypothetical_protein_[Borreliella_burgdorferi_B31]
EEH32441    hypothetical_protein_BBU29805_0856_[Borreliella_burgdorferi_29805]
AAF07414    2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
AA_F07637   BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07415    borrelia_orf-D_family_(plasmid)_[Borreliella_burgdorferi_B31]
AAF_07637   BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07414    2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
PRR_07352   hypothetical_protein_CV677_05765_[Borreliella_burgdorferi]
EEG99465    conserved_hypothetical_protein_[Borreliella_burgdorferi_94a]

1 Answer 1

1

Like this:

$ sed -E 's/(\.[1,2]+)_/\1\t/' file
WP_162009627.1  hypothetical_protein_[Borreliella_burgdorferi]
AAC67153.1  translation_initiation_factor_IF-2_putative_[Borreliella_burgdorferi_B31]
AA_C67154.1 transcription_elongation_protein_NusA_[Borreliella_burgdorferi_B31]
AAC67155.1  conserved_hypothetical_protein_[Borreliella_burgdorferi_B31]
EEH32441.1  hypothetical_protein_BBU29805_0856_[Borreliella_burgdorferi_29805]
AAF07414.1  2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
AA_F07637.1 BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07415.2  borrelia_orf-D_family_(plasmid)_[Borreliella_burgdorferi_B31]
AAF_07637.1 BlyB_(plasmid)_[Borreliella_burgdorferi_B31]
AAF07414.1  2.9-7_ORF-C_(plasmid)_[Borreliella_burgdorferi_B31]
PRR_07352.1 hypothetical_protein_CV677_05765_[Borreliella_burgdorferi]
EEG99465.1  conserved_hypothetical_protein_[Borreliella_burgdorferi_94a]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .