[nSLUG] Tar (was: Thumbdrive filenames problem)

Johann Tienhaara jtienhaara at yahoo.com
Sun Aug 23 10:59:35 ADT 2015

Mike Spencer wrote:
> I dislike tar for backups because there's no way (or I've not
> discovered a way) to extract /path/to/some/file to ./file without
> recreating ./path/to/some.

On the 6th day God created man:

    johann at bearberry:~/ttt$ man tar

    --transform, --xform EXPRESSION

          use sed replace EXPRESSION to transform file names

One possible example:

    johann at bearberry:~/ttt$ tar xvzf ttt.tar.gz \
        --transform 's|^.*/\([^/]*\)$|\1|'

    johann at bearberry:~/ttt$ ls -1

(N.b. I'm not very good with biblical quotes, so I tried "man genesis"
 to figure out which day it was.  That didn't work.  Fortunately
 on the 7th day God created duckduckgo.)


More information about the nSLUG mailing list