For instance I have a JSON file like this:
{
"mac": "00:11:22:33:44:55",
"name: "Test123",
"ssid": "29321",
"password": "txt",
"data": {
"test:": "no",
"dev": "yes",
"prod": false
},
"signals": [12, 34, 65, 93, 21],
}
I'd like to grep a particular JSON key (including subkeys) from data above, but when I cat that file or read a JSON file from somewhere else in the output stream, ie wget or curl.
So far I have tried only this:
cat json.txt | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
This returns the "mac" key value, grep's it by a pattern, strips all the quotes in the output and it really works flawlessly!
I honestly haven't tried anything regardings JSON keys, since any regular-expression system is not my stronger point and I hope you'll all help me about this.
NOTE: I'm very limited on the system where I'll be running this, so the -P option is not available.
EDIT: Actually, we do have root access to devices. They're running on MIPS platform and we have no compilers on the system installed. All the apps we can install must be already precompiled, so I doubt I'll find jq or jshon for these devices.
If there's another tool, that'd be helpful, probably.
EDIT 2: Issuing command: akw --version, we get this response:
BusyBox v1.19.4 (2017-03-27 19:07:06 EEST) multi-call binary.
jq.grep, etc.