I'm writing a shell script to remove the second element in the array using jq where ID= "dimes-snapshot" and time= 2017-01-09T22:41:46.229000+00:00
The array is in a snapshot.json file and I would like the changes to the array be reflected in that file
[
{
"ID": "delete-05032019",
"Time": "2019-05-03T18:01:12.375000+00:00"
},
{
"ID": "dimes-snapshot",
"Time": "2017-01-09T22:41:46.229000+00:00"
},
{
"ID": "dimes-snapshot-2",
"Time": "2018-02-28T16:06:09.091000+00:00"
}
]
I've tried this command but it doesn't work
jq "del(.[] | select(.id == $ID))" snapshots.json