{"jsonrpc":"2.0","result":[{"groupid":"63","name":"1voda","internal":"0","flags":"0"}],"id":1}
echo '"{"jsonrpc":"2.0","result":[{"groupid":"63","name":"1voda","internal":"0","flags":"0"}],"id":1}"' | cut -d\" -f11
:
echo '{"jsonrpc":"2.0","result":[{"groupid":"63","name":"1voda","internal":"0","flags":"0"}],"id":1}' | jq -r '.result[0].groupid'
:
$ echo '{"jsonrpc":"2.0","result":[{"groupid":"63","name":"1voda","internal":"0","flags":"0"}],"id":1}'|jq .result[0].groupid
"63"
Как из нее получить значение ключа groupid - т. е. число 63?
echo "$MYSTRING"|awk -F\" '{print $10}'
echo "$MYSTRING"|grep -oP "groupid\":\"\K\d*"
echo "$MYSTRING"|jq -r ".result[].groupid"
TMP="${MYSTRING#*groupid\":\"}";echo "${TMP%%\"*}"
echo $MYSTRING|cut -d\" -f 10