【发布时间】:2021-10-12 19:16:20
【问题描述】:
我正在尝试根据区域包含us-west- 的位置从该列表中提取ip_prefix,并在csv 中列出它们。当我尝试jq '.prefixes[] | .ip_prefix,.region | select(contains("us")?)' file.json 时,我只得到一个地区列表。
{
"syncToken": "15985471",
"createDate": "2021-10-08-20-13-16",
"prefixes": [
{
"ip_prefix": "3.5.140.0/22",
"region": "ap-northeast-2",
"service": "AMAZON",
"network_border_group": "ap-northeast-2"
},
{
"ip_prefix": "13.34.37.64/27",
"region": "ap-southeast-4",
"service": "AMAZON",
"network_border_group": "ap-southeast-4"
},
{
"ip_prefix": "35.180.0.0/16",
"region": "eu-west-3",
"service": "AMAZON",
"network_border_group": "eu-west-3"
},
{
"ip_prefix": "52.93.153.170/32",
"region": "eu-west-2",
"service": "AMAZON",
"network_border_group": "eu-west-2"
},
{
"ip_prefix": "52.93.178.234/32",
"region": "us-west-1",
"service": "AMAZON",
"network_border_group": "us-west-1"
}
]
}
【问题讨论】:
标签: jq