I have this header: >tr|G3Q381|G3Q381_GASAC Uncharacterized protein OS=Gasterosteus aculeatus PE=4 SV=1and I was thankfully helped on here to get it to:  >G3Q381_GASACbut now I need to cut the last two letters off of the previous format like this:   >G3Q381_GASIs it possible from the initial long header (not middle truncated one) to get it to this? 
Remove characters from string with sed
linux;bash;sed
I don't know if it acceptable, but you can remove everything before the second pipe |, and everything after the first space minus 2 characters :sed -e 's/^[^|]*|/>/' -e 's/^[^|]*|/>/' -e 's/.. .*$//'