シェルスクリプトを作成している途中で取得したデータの整形に悩んでおります。
以下のデータを取得しています。
json
1# notificationId.json 2{ 3 "Count": 4456, 4 "Items": [ 5 { 6 "status": { 7 "S": "Finish" 8 }, 9 "prospective": { 10 "N": "20" 11 }, 12 "success": { 13 "N": "10" 14 }, 15 "unknown": { 16 "N": "0" 17 }, 18 "updatedAt": { 19 "N": "1531470204917" 20 }, 21 "pushNotified": { 22 "N": "13" 23 }, 24 "failure": { 25 "N": "3" 26 }, 27 "appId": { 28 "S": "apple-drink" 29 }, 30 "notificationId": { 31 "S": "aaabbbccc" 32 }, 33 "type": { 34 "S": "All" 35 }, 36 "createdAt": { 37 "N": "1531470204874" 38 } 39 }, 40 { 41 "status": { 42 "S": "InProgress" 43 }, 44 "prospective": { 45 "N": "1" 46 }, 47 "success": { 48 "N": "0" 49 }, 50 "unknown": { 51 "N": "0" 52 }, 53 "updatedAt": { 54 "N": "1439542730998" 55 }, 56 "pushNotified": { 57 "N": "0" 58 }, 59 "failure": { 60 "N": "0" 61 }, 62 "totalSegments": { 63 "N": "1" 64 }, 65 "appId": { 66 "S": "orange-drink" 67 }, 68 "notificationId": { 69 "S": "dddeeefff" 70 }, 71 "type": { 72 "S": "Personal" 73 }, 74 "createdAt": { 75 "N": "1439542730998" 76 } 77 }, 78 . 79 . 80 ], 81 "NextToken": "None___5", 82 "ScannedCount": 4456, 83 "ConsumedCapacity": null 84}
上記データを以下のように"notificationId"のみに整形したいです。
json
1{ 2 "notificationId": {"S": "aaabbbccc"}, 3 "notificationId": {"S": "dddeeefff"}, 4 . 5 . 6 . 7}
○やってみたこと
以下のようにして見たのですが複数のjsonの形になってしまいます。
簡単のようでかなり時間取られ結果わからずじまいだったので質問させて頂きました。
shell
1$ cat notification.json | jq '.Items[] | { notificationId: .notificationId}' 2{ 3 "notificationId": {"S": "aaabbbccc"} 4} 5{ 6 "notificationId": {"S": "dddeeefff"} 7} 8{ 9 . 10} 11{ 12 . 13}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。