tar(1) has a neat option called
--transform. From the man page:
--transform, --xform EXPRESSION
use sed replace EXPRESSION to transform file names
This allows transformation of path names on the fly as the archive is being extracted so that you may control where and how it will be extracted.
My question is, is there a way to perform a similar transformation in situ; i.e., without extracting the archive?
[user@host]$ tar tf test.tar ./foo/blah ./foo/bleh [user@host]$ some_deep_magic 's/foo/bar/' test.tar [user@host]$ tar tf test.tar ./bar/blah ./bar/bleh
I'm distributing a
tar archive to basically clueless end users and would like it to extract into the correct path without interference from me. I'm trying to avoid the trivial solution of extracting the archive, renaming the directories and repacking as the archive is largish.