I have strings in the following pattern: <SOMETHING_1>{<JSON>}<SOMETHING_2>
I want to keep the <JSON> and remove the <SOMETHING_X>blocks. I'm trying to do it with substring removal, but instead of getting
{x:1,action:PLAYING,name:John,description:Some description rSxv9HiATMuQ4wgoV2CGxw}
I keep getting
{x:1,action:PLAYING,name:John,description:Some}
because the whitespace in the description field cuts off the substring.
Any ideas on what to change?
CODE:
string="000{x:1,action:PLAYING,name:John,description:Some description rSxv9HiATMuQ4wgoV2CGxw}401"
string=$1
string=$(echo "${string#*{}")
string=$(echo "${string%}*}")
string={$string}
echo $string
{...}inside?$1by invokingyourscript $somevarthat would cause the problem, on account of needing to beyourscript "$somevar"; everything after the space is going into$2or a subsequent argument.string=$1line for?