我正在尝试使用 JMESPath jp
( https://github.com/jmespath/jp ) 实用程序应用过滤器。我的目标是只让状态为“已添加”并0000debf17cff54b
过滤掉特定设备 ID(例如)的流。
我正在尝试这样的事情:
cat test | ./jp '[][?id=="of:00002259146f7743" && state=="ADDED"]'
但结果是[]
[
{
"flow": [
{
"ethType": "0x86dd",
"type": "ETH_TYPE"
},
{
"protocol": 58,
"type": "IP_PROTO"
},
{
"icmpv6Type": 135,
"type": "ICMPV6_TYPE"
}
],
"id": "of:00001aced404664b",
"state": "ADDED"
},
{
"flow": [
{
"ethType": "0x86dd",
"type": "ETH_TYPE"
},
{
"protocol": 58,
"type": "IP_PROTO"
},
{
"icmpv6Type": 136,
"type": "ICMPV6_TYPE"
}
],
"id": "of:0000debf17cff54b",
"state": "ADDED"
}
]