http://www.unix.com/unix-dummies-questions-answers/15182-extract-tar-files-without-creating-directory.html
which led me to pax.
I found I could do what I wanted here with three options:
pax -r -i -f [archive] [pattern_matching_desired_file]
The -r is for read from an archive.
The -f is to give it the name of the archive file.
The -i is for name the pulled out file interactively. This meant I had to rename the file, which allowed me to leave out the parent directories.
(There are many more options on the man page, of course!)
Here's how to pull a file out of a tar without having to create all the subdirectories:
$lsTo pull out the changed3.ksh without creating its parent directories:
mychanges.tar
$ tar -tvf mychanges.tar
-rw-rw-r-- sam/zac 193 2009-05-18 06:02:23 dir1/changed1.c
-rw-r--r-- sam/zac 3708 2009-05-18 05:57:05 dir2/changed2.py
-rwxr-x--x sam/zac 9708 2009-05-18 05:51:34 dir3/dir4/dir5/dir6/changed3.ksh
-rw-rw-r-- sam/zac 2282 2009-05-18 05:54:57 dir3/dir4/dir5/dir6/dir7/dir8/dir9/cpx.cfg
$ pax -r -i -f mychanges.tar *.kshNow you have your file in the current directory.
ATTENTION: pax interactive file rename operation.
-rwxr-x--x May 18 05:51 dir3/dir4/dir5/dir6/changed3.ksh
Input new name, or a "." to keep the old name, or a "return" to skip this file.
Input > changed3here.ksh
Processing continues, name changed to: changed3here.ksh
$ ls
changed3here.ksh mychanges.tar
To pull out another:
$pax -r -i -f mychanges.tar *cpx.cfgAnd there it is:
ATTENTION: pax interactive file rename operation.
-rw-rw-r-- May 18 05:54 dir3/dir4/dir5/dir6/dir7/dir8/dir9/cpx.cfg
Input new name, or a "." to keep the old name, or a "return" to skip this file.
Input > cpx.cfg
Processing continues, name changed to: cpx.cfg
$ ls
cpx.cfg changed3here.ksh mychanges.tar