If I want to delete age from the JSON in first output. Is there a way to do that in one step, in other words, not invoking jq 2 times?
➜ $?=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] ➤