【发布时间】:2019-06-25 21:17:05
【问题描述】:
我有 >100 个文件,其中每一行都是一个 json。它看起来像这样(没有逗号,没有 []):
{"one":"one","two":{"tree":...}}
{"one":"one","two":{"tree":...}}
...
{"one":"one","two":{"tree":...}}
为了能够使用 aws firehose put-record-batch,文件需要采用以下格式:
[
{
"Data": blob
},
{
"Data": blob
},
...
]
我想将所有这些文件从终端放入 aws Firehose。
我正在寻找一个看起来像这样的 shell 脚本:
for file in files
do
aws firehose put-record-batch --delivery-stream-name <name> --records file://$file
done
所以有两个问题:
- 如何将文件转换为适用的格式
- 还有,如何遍历所有文件
【问题讨论】:
标签: amazon-web-services shell aws-cli amazon-kinesis-firehose