Skip to main content
Yes, but no ability to comment yet, hoping to get some reputation points from somewhere...
Source Link
social
  • 315
  • 2
  • 7

Also answered & tested here including extract Key Value from JSON example using only grep :

https://unix.stackexchange.com/a/694241/518235

No jq, awk, sed:

#!/bin/bash
json='{"access_token":"kjdshfsd", "key2":"value"}' 
    
echo $json | grep -o '"access_token":"[^"]*' | grep -o '[^"]*$'

Tested & working here: https://ideone.com/Fw4How

source: https://brianchildress.co/parse-json-using-grep

Also answered & tested here including extract Key Value from JSON example using only grep :

https://unix.stackexchange.com/a/694241/518235

Also answered & tested here including extract Key Value from JSON example using only grep :

https://unix.stackexchange.com/a/694241/518235

No jq, awk, sed:

#!/bin/bash
json='{"access_token":"kjdshfsd", "key2":"value"}' 
    
echo $json | grep -o '"access_token":"[^"]*' | grep -o '[^"]*$'

Tested & working here: https://ideone.com/Fw4How

source: https://brianchildress.co/parse-json-using-grep

Source Link
social
  • 315
  • 2
  • 7

Also answered & tested here including extract Key Value from JSON example using only grep :

https://unix.stackexchange.com/a/694241/518235