我怎么能不带尾巴读取它的全部内容压缩文件? [英] How can I tail a zipped file without reading its entire contents?

查看:108
本文介绍了我怎么能不带尾巴读取它的全部内容压缩文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想效仿gzcat的功能|尾-n。

I want to emulate the functionality of gzcat | tail -n.

这将是时间帮助时,存在着巨大的文件(几个GB的左右)。我可以尾部的最后几行这样的文件的W / O从一开始读它?我怀疑,这是不可能的,因为我猜的GZIP,编码将取决于所有的previous文本。

This would be helpful for times when there are huge files (of a few GB's or so). Can I tail the last few lines of such a file w/o reading it from the beginning? I doubt that this won't be possible since I'd guess for gzip, the encoding would depend on all the previous text.

但我仍想听到的话,任何人尝试过做类似的东西 - 也许调查过一个COM pression算法,可以提供这样的功能

But still I'd like to hear if anyone has tried doing something similar - maybe investigating over a compression algorithm that could provide such a feature.

推荐答案

没有,你不能。该荏苒算法其内部的编码适用于流和适应什么流包含实现其高COM pression比。

No, you can't. The zipping algorithm works on streams and adapts its internal codings to what the stream contains to achieve its high compression ratio.

不知道是什么流的内容是某一个点之前,是不可能知道如何去解COM pressing从这一点上。

Without knowing what the contents of the stream are before a certain point, it's impossible to know how to go about de-compressing from that point on.

任何算法,它可以让你去COM preSS它的任意部分,需要多次传递过来的数据,以COM preSS吧。

Any algorithm which allows you to de-compress arbitrary parts of it will require multiple passes over the data to compress it.

这篇关于我怎么能不带尾巴读取它的全部内容压缩文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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