编写bash脚本的一部分,从下面列出的每条记录中提取Description,VolumeId,SnapshotId和StartTime。意图是通过StartTime对记录进行排序,以允许另一步骤根据此时间删除记录。我将需要这些字段来识别某些快照的有效性。您如何建议我从每条记录中提取数据,以便按StartTime排序?最后,我需要计算记录并根据时间删除最旧的记录,并通过提取SnapshotId删除记录。
示例数据:
"Snapshots": [
{
"Description": "HipChat_30min_Snapshot",
"Encrypted": false,
"VolumeId": "vol-0acc184304bb512a5",
"State": "pending",
"VolumeSize": 100,
"Progress": "4%",
"StartTime": "2017-02-20T14:02:45.000Z",
"SnapshotId": "snap-0f9a3613023a3038d",
"OwnerId": "346720985731"
},
{
"Description": "HipChat_30min_Snapshot",
"Encrypted": false,
"VolumeId": "vol-0acc184304bb512a5",
"State": "completed",
"VolumeSize": 100,
"Progress": "100%",
"StartTime": "2017-02-20T13:53:11.000Z",
"SnapshotId": "snap-0da7b040554eb0d65",
"OwnerId": "346720985731"
}