如何grep到存储在S3中的文件 [英] How to grep into files stored in S3

查看:74
本文介绍了如何grep到存储在S3中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何通过aws S3直接在存储桶中对S3文件执行grep吗? 例如,我有FILE1.csv,FILE2.csv,其中有很多行,并且想要查找包含字符串JZZ的行

Do anybody know how to perform grep on S3 files with aws S3 directly into the bucket? For example I have FILE1.csv, FILE2.csv with many rows and want to look for the rows that contain string JZZ

aws s3 ls --recursive s3://mybucket/loaded/*.csv.gz | grep ‘JZZ’

推荐答案

aws s3 cp命令可以将输出发送到stdout:

The aws s3 cp command can send output to stdout:

aws s3 cp s3://mybucket/foo.csv - | grep 'JZZ'

连字符(-)表示命令将输出发送到stdout.

The dash (-) signals the command to send output to stdout.

请参阅:如何使用AWS S3 CLI将文件转储到BASH中的stdout?

这篇关于如何grep到存储在S3中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆