Thanks JC, it is great solution.
Now I have a different issue here, because I need the gene name at the beginning of the 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 the output should be
>trpE_MALBOS1_000000117228
Any ideas?