I am trying to substring many strings with bash.However, despite the prefix is sorrectly deleted, the suffix is not.
One of the strings:
lcl|MK087647.1_cds_QHD46953.1_7_[gene=rpl2]_[protein=ribosomal_protein_L2]_[exception=RNA_editing]_[protein_id=QHD46953.1]_[location=complement(71768..73444)]_[gbkey=CDS]
The desired output:
MK087647.1_cds_QHD46953.1_7_[gene=rpl2]_[protein=ribosomal_protein_L2]
The code
for row in $colonna2; do tmp=${row#*lcl|}
colonna2_newname=${tmp%exception=*} echo $colonna2_newname; done
The output
MK087647.1_cds_QHD46953.1_7_[gene=rpl2]_[protein=ribosomal_protein_L2]_[exception=RNA_editing]_[protein_id=QHD46953.1]_[location=complement(71768..73444)]_[gbkey=CDS]
Any guess why the suffix is not deleted? Has my syntax some error?
Thanks in advance