【发布时间】:2017-02-09 10:42:52
【问题描述】:
我有一个如下所示的文件:
{
"repositories": [
{
"id": "156c48fc-f208-43e8-a631-4d12deb89fa4",
"namespace": "rhel12",
"namespaceType": "organization",
"name": "rhel6.6",
"shortDescription": "",
"visibility": "public"
},
{
"id": "f359b5d2-cb3a-4bb3-8aff-d879d51f1a04",
"namespace": "rhel12",
"namespaceType": "organization",
"name": "rhel7",
"shortDescription": "",
"visibility": "public"
}
]
}
我只想在新行中获取每个名称值,以便我可以使用while read -r line。
我只需要
rhel6.6
rhel7
我正在使用 jq 如下,这似乎不起作用:
jq -r '.[].name'
请在此处建议正确使用 jq
【问题讨论】: