I'm unable to filter by keys using jq.
# /home/test/show_param_db.sh -p memory -h host00* -f json | jq '.[]'
> [ {
> "host001": {
> "status": "OK",
> "msg": "",
> "data": [
> {
> "hi_shared_memory_address": "0"
> },
> {
> "memory_max_target": "1G"
> },
> {
> "memory_target": "1G"
> },
> {
> "shared_memory_address": "0"
> }
> ]
> },
> "host002": {
> "status": "ERROR",
> "msg": "su: user oracle does not exist",
> "data": []
> } } ]
When I tried to filter by keys:
# /home/test/show_param_db.sh -p memory -h host00* -f json | jq -r '.["host001"]'
==> null
Or even list out the keys:
# /home/test/show_param_db.sh -p memory -h host00* -f json | jq -r '.[]' | jq -r 'keys'
[ 0 ]
I'm hoping to get json by hostname. Thanks for all suggestions.