How to solve word count problem in Hive?
April 9, 2021How to specify conditional expressions (OR, AND, NOT) when searching documents in Elasticsearch?
April 14, 2021This is a very common requirement and it has an easy solution.
Solution
aws s3api get-object to get the object and use to –range option to fetch only the specified number of bytes.
Since we are just previewing the content, instead of writing to a file we can send the output to standard output by specifying /dev/stdout and followed by a pipe to head
[osboxes@wk1 ~]$ aws s3api get-object --bucket hirw-bucket-versions --key version-test --range bytes=0-1000 /dev/stdout | head Hello, this is VERSION TWO { "AcceptRanges": "bytes", "LastModified": "2020-11-18T19:40:35+00:00", "ContentLength": 27, "ETag": "\"04cf95a672923b5c021568765b336c4f\"", "VersionId": "8LKeiP26.7WS_CUYUmY_BNmpIX0ljIxa", "ContentRange": "bytes 0-26/27", "ContentType": "binary/octet-stream", "Metadata": {}