Hi all,
I'm looking for a simple solution for renaming fasta headers.

I have this fasta header

    >trpE___AA_HMM___6fa05435949258489b608db9e58e5ba38821f2f26fffe5755daff43abin_id:MALBOS1|source:AA_HMM|e_value:5.2e99|contig:MALBOS1_000000117228|gene_callers_id:113772|start:215745|stop:217260|length:1515

And I would like to rename it only like this

    >MALBOS1_000000117228

That means, remove everything before the pattern "contig:" and after  "|gene_callers_id"

Any ideas?

thanks

    perl -pe 's/>.+contig:(.+?)\|.+/>$1/' < FASTA_IN > FASTA_OUT