How do I print using grep awk just to print success from the below string.
{"identity":"2320147","authentication":"success"}
How do I print using grep awk just to print success from the below string.
{"identity":"2320147","authentication":"success"}
Using GNU awk
:
echo "{"identity":"2320147","authentication":"success"}" |awk -F "[:}]" '{print $3}'
Output:
success
Use jq
test='{"identity":"2320147","authentication":"success"}'
$ jq -r '.authentication' <<< $test
success
JQ's help
$ jq -h
jq - commandline JSON processor [version 1.5-1-a5b5cbe]
...
-r output raw strings, not JSON texts;
...