“头" AWS s3命令以查看文件内容

编程入门 行业动态 更新时间:2024-10-15 10:17:53
本文介绍了“头" AWS s3命令以查看文件内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Linux上,我们通常使用head/tail命令预览文件的内容.它有助于查看文件的一部分(例如检查格式),而不是打开整个文件.

On Linux, we generally use the head/tail commands to preview the contents of a file. It helps in viewing a part of the file (to inspect the format for instance), rather than open up the whole file.

对于Amazon S3,似乎只有ls,cp,mv等.命令我想知道是否可以查看文件的一部分,而无需使用cp/GET在本地计算机上下载整个文件.

In the case of Amazon S3, it seems that there are only ls, cp, mv etc. commands I wanted to know if it is possible to view part of the file without downloading the entire file on my local machine using cp/GET.

推荐答案

从S3检索数据时,您可以指定一个字节范围,以获取前N个字节,后N个字节或两者之间的任何内容. (这也很有用,因为它允许您并行下载文件-只需启动多个线程或进程,每个线程或进程都检索全部文件的一部分.)

You can specify a byte range when retrieving data from S3 to get the first N bytes, the last N bytes or anything in between. (This is also helpful since it allows you to download files in parallel – just start multiple threads or processes, each of which retrieves part of the total file.)

我不知道哪种CLI工具直接支持此功能,但是范围检索可以满足您的需求.

I don't know which of the various CLI tools support this directly but a range retrieval does what you want.

AWS CLI工具(精确地说是"aws s3 cp")不允许您进行范围检索,但是s3curl( aws.amazon/code/128 )应该可以解决问题.(例如,使用--range参数进行普通卷曲也可以,但是您必须执行请求签名靠你自己.)

The AWS CLI tools ("aws s3 cp" to be precise) does not allow you to do range retrieval but s3curl (aws.amazon/code/128) should do the trick.(So does plain curl, e.g., using the --range parameter but then you would have to do the request signing on your own.)

更多推荐

“头" AWS s3命令以查看文件内容

本文发布于:2023-11-23 16:42:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622166.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令   文件   内容   quot   AWS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!