【发布时间】:2020-02-05 06:21:41
【问题描述】:
我有多个如下所示的 JSON 文件。
{
"09800214851900C3": {
"label": "P7-R1-R16:S2",
"name": "Geist Upgradable rPDU",
"state": "normal",
"order": 0,
"type": "i03",
"snmpInstance": 1,
"lifetimeEnergy": "20155338",
"outlet": {},
"alarm": {
"severity": "",
"state": "none"
},
"layout": {
"0": [
"entity/total0",
"entity/phase0",
"entity/phase1",
"entity/phase2"
]
}
}
}
从这里,我想使用 jq 像下面这样提取
09800214851900C3 : P7-R1-R16:S2
我遇到的问题是这个数组值 {09800214851900C3} 与所有 JSON 文件都不相同。所以我需要帮助来提取相同的内容。
【问题讨论】: