如果我想在第一个输出中从JSON中删除age
。有没有办法一步完成,换句话说,没有调用jq 2次?
➜ $?=0 @arastogi-ld2.linkedin.biz inGraphs/common-templates [ 1:39AM] ➤ echo '[{"id": 1, "name": "Arthur", "age": "21"},{"id": 2, "name": "Richard", "age": "32"}]' | jq .
[
{
"id": 1,
"name": "Arthur",
"age": "21"
},
{
"id": 2,
"name": "Richard",
"age": "32"
}
]
>>> 0s elasped...
➜ $?=0 @arastogi-ld2.linkedin.biz inGraphs/common-templates [ 1:39AM] ➤ echo '[{"id": 1, "name": "Arthur", "age": "21"},{"id": 2, "name": "Richard", "age": "32"}]' | jq '.[] | del(.age)' | jq -s
[
{
"id": 1,
"name": "Arthur"
},
{
"id": 2,
"name": "Richard"
}
]
>>> 1s elasped...
➜ $?=0 @arastogi-ld2.linkedin.biz inGraphs/common-templates [ 1:39AM] ➤