bash can strip parts from the contents of shell variables.
${parameter#pattern} returns the value of parameter $ without the part at the beginning that matches pattern .
${parameter%pattern} returns the value of parameter $ without the part at the end that matches pattern .
I think there is a better way to do this, but it should work. So you can combine this in:
% strip the part before the value: test=${test#Msg } % strip the part after the value: test=${test%, Level*} echo $test
If you are interested in the part (return status = xxx) , this will be:
result=${test#*(result status = } result=${result%)*} echo $result
The relevant section in the bash man page is โParameter Extensionโ.
fmarc source share