【发布时间】:2017-06-07 09:44:05
【问题描述】:
在使用 jq 解析 Json 数据时需要帮助,我曾经使用 json 路径作为 [?(@.type=='router')].externalIP 来解析数据。我不知道如何使用 jq 来做同样的事情。
查询结果应提供来自 type=router 的 .externalIp。 198.22.66.99
json数据sn-p如下
[
{
"externalHostName": "localhost",
"externalIP": "198.22.66.99",
"internalHostName": "localhost",
"isUp": true,
"pod": "gateway",
"reachable": true,
"region": "dc-1",
"type": [
"router"
],
"uUID": "b5f986fe-982e-47ae-8260-8a3662f25fc2"
},
]
##
【问题讨论】: