[英]Does ungzipping the result of concatenating two gzipped files always equal the result of concatenating the two files in their raw and ungzipped form?
在我的简短测试中,情况确实如此,但我想知道是否可以依赖该属性。
无论file1
和file2
的内容file4
, file3
总是等于file4
吗?
cat file1 file2 > file3
gzip file1
gzip file2
cat file1.gz file2.gz | gunzip - > file4
# Are file3 and file4 necessarily the same?
根据手册页,是的。 这是记录在案的行为。
http://www.gnu.org/software/gzip/manual/html_node/Advanced-usage.html
高级用法
可以连接多个压缩文件。 在这种情况下, gunzip 将一次提取所有成员。 如果一个成员被损坏,在移除损坏的成员后,其他成员仍可能被恢复。 如果所有成员都被解压缩,然后在一个步骤中重新压缩,通常可以获得更好的压缩。
这是连接 gzip 文件的示例:
gzip -c file1 > foo.gz gzip -c file2 >> foo.gz Then gunzip -c foo is equivalent to cat file1 file2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.