<分区>
我的 JSON 输出如下所示;
{
"1":{
"state":{
"on":false,
"bri":124,
"hue":14985,
"sat":252,
"effect":"none",
"xy":[
0.5182,
0.4363
],
"ct":480,
"alert":"none",
"colormode":"xy",
"reachable":true
},
"type":"Extended color light",
"name":"Slaapkamer rechts",
"modelid":"LCT001",
"manufacturername":"Philips",
"uniqueid":"00:17:88:01:00:dc:36:68-0b",
"swversion":"66013187"
},
"2":{
"state":{
"on":false,
"bri":125,
"hue":14984,
"sat":252,
"effect":"none",
"xy":[
0.5182,
0.4363
],
"ct":480,
"alert":"none",
"colormode":"xy",
"reachable":true
},
"type":"Extended color light",
"name":"Slaapkamer links",
"modelid":"LCT001",
"manufacturername":"Philips",
"uniqueid":"00:17:88:01:00:dc:33:99-0b",
"swversion":"66013187"
}
}
有谁知道使此输出可 grep 的简单方法?或者任何其他方式将输出放在一行上,以便我可以在 json 输出上使用 grep、awk 等工具? 如果我现在对“色调”一词执行 grep,那么我会得到 2 行;
"hue":14985,
"hue":14984,
虽然我有时只想在第一个或第二个上 grep..
有什么想法吗?