gpt4 book ai didi

linux - 解压缩连接两个 gzip 文件的结果是否总是等于以原始和解压缩形式连接两个文件的结果?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:25:24 25 4
gpt4 key购买 nike

在我的简短测试中,情况确实如此,但我想知道是否可以依赖该属性。

无论 file1file2 的内容如何,​​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

Advanced usage

Multiple compressed files can be concatenated. In this case, gunzip will extract all members at once. If one member is damaged, other members might still be recovered after removal of the damaged member. Better compression can be usually obtained if all members are decompressed and then recompressed in a single step.

This is an example of concatenating gzip files:

 gzip -c file1  > foo.gz
gzip -c file2 >> foo.gz Then

gunzip -c foo is equivalent to

cat file1 file2

关于linux - 解压缩连接两个 gzip 文件的结果是否总是等于以原始和解压缩形式连接两个文件的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13617918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com