I have a variable in bash that is an output of Amazon EMR create command;
CLUSTER=$(aws emr create-cluster ...)
echo $CLUSTER
the output is like this:
{ "ClusterId": "j-9YWMBYN98LN7" }
What I need to do is to extract the value j-9YWMBYN98LN7
to a new variable, something like:
ID=$CLUSTER.(ClusterId)
Of course the above command doesn't work. I have tried with jq but no luck.
ID=$(jq -r '.ClusterId' $CLUSTER)
The thing is I'm not even sure what type $CLUSTER is. How do I extract the value j-9YWMBYN98LN7
there? Thanks