本文介绍了将文件从tar传递到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解压缩多文件存档.而且我必须使用二进制文件来进行实际的编写.

I need to untar a multiple-file archive. And I have to use a binary to do the actual writing.

有了一个文件存档,我对

With a single file archive, I'm happy with

tar -Oxvf singlefile.tgz | writer filename

对于多个文件,tar具有"--to-command"选项,该选项将每个文件传送到指定的命令.听起来不错,但是文件名呢?

for multiple files, tar has a "--to-command" option that pipes each file to a specified command. Sounds good but what about the file names?

>tar xvf test.tgz --to-command='writer' 2> /dev/null
tets1
test2
test3

tar似乎将文件名输出到其stdout,并且我找不到在命令内获取文件名的方法.

tar seems to output the filenames to its stdout, and I couldn't find a way to get the filenames within the command.

有什么想法吗?

谢谢,亚历克斯

推荐答案

您是否已阅读 tar男人页和GNU tar 文档?

Did you read the tar man page and the GNU tar documentation ?

您可能也会对 tardy

这篇关于将文件从tar传递到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 00:53