单行从jq获取输出
(.issues[] | {key, status: .fields.status.name, assignee: .fields.assignee.emailAddress})
输出:
{ "key": "SEA-739",
"status": "Open",
"assignee": null
}
{
"key": "SEA-738",
"status": "Resolved",
"assignee": "user2@mycompany.com"
}
但是我需要解析每一行,但是就密钥组而言,很难确定哪个受让人对应哪个密钥。使用jq可以使一束成行吗?
预期产量:
{ "key": "SEA-739", "status": "Open", "assignee": null }{ "key": "SEA-738", "status": "Resolved", "assignee": "user2@mycompany.com"}
要么
{ "SEA-739", "Open", null }{ "SEA-738", "Resolved", user2@mycompany.com }
回答:
您可能需要的是
使用上面发布的输出,可以进行进一步处理:
jq **-c** 。输入
给予
{"key":"SEA-739","status":"Open","assignee":null}{"key":"SEA-738","status":"Resolved","assignee":"user2@mycompany.com"}
或者您可以只更改原始命令
jq **-r** '(.issues [] | {键,状态:.fields.status.name,受让人:.fields.assignee.emailAddress})'
jq **-c** '(.issues [] | {键,状态:.fields.status.name,受让人:.fields.assignee.emailAddress})'
以上是 单行从jq获取输出 的全部内容, 来源链接: utcz.com/qa/399289.html