如何从 tar 中删除前导路径并将其重新添加到内存中?

Mic*_*ale 7 download path tar

我想我可以做这样的事情:

wget -O- http://example.com/funky.tar.gz | \
  tar --strip-components 1 -Ox | tar -cf fixed.tar.gz
Run Code Online (Sandbox Code Playgroud)

从下载的 tar 中的所有项目中删除前导路径,但似乎无法从 stdin 创建 tar。请证明我是错的。

Ale*_*lex 2

您当然可以从标准输入创建一个 tar。用作-源,并将您想要压缩的任何内容通过管道传输到其中。

http://ss64.com/bash/tar.html

http://www.google.com/search?q=tar+stdin