I have a string that looks like this:
blahblahblah_^substring^_blahblahblah
I need to extract substring, the bit between the ^ characters, into another string variable. This will be in a bash shell script.
Thanks.
I have a string that looks like this:
blahblahblah_^substring^_blahblahblah
I need to extract substring, the bit between the ^ characters, into another string variable. This will be in a bash shell script.
Thanks.
echo "blahblahblah_^substring^_blahblahblah" | sed 's/.*_^\(.*\)^_.*/\1/'
echo "$variable" | awk -F '^' '{ print $2}'
You can also use parameter substitution.