我已经使用命令创建了cpio.gz:
cat a.cpio.gz b.cpio.gz > c.cpio.gz
现在我要将此c.cpio.gz文件解压缩到b.cpio.gz和a.cpio.gz.我怎么能做到这一点?
答案 0 :(得分:0)
好的,我有2个.gz
个文件,a.txt.gz
和b.txt.gz
。然后:
$ cat a.txt.gz b.txt.gz > c.txt.gz
$ hexdump -C c.txt.gz
00000000 1f 8b 08 08 f7 a3 00 59 00 03 61 2e 74 78 74 00 |.......Y..a.txt.|
00000010 4b 2c 4e e1 4a 24 80 01 a9 66 ae 58 24 00 00 00 |K,N.J$...f.X$...|
00000020 1f 8b 08 08 01 a4 00 59 00 03 62 2e 74 78 74 00 |.......Y..b.txt.|
00000030 2b 2c 4f e5 2a 24 0a 73 a5 72 01 00 70 24 d5 0a |+,O.*$.s.r..p$..|
00000040 2d 00 00 00 |-...|
从0x00和0x20开始查看那些1f 8b 08
,它们是.gz
个文件(based on the article I referred to in the OP's comments)的BOF标记。现在有些awk:
$ awk '
BEGIN { RS="\x1f\x8b\x08"; ORS="" } # set the marker to RS
NR==2 { print RS $0 > "a2.txt.gz" } # output the marker and what's after first marker
NR==3 { print RS $0 > "b2.txt.gz" } # output the marker and what's after the second
' c.txt.gz
生成2个文件,根据我的diff
,它们与原始文件相同。