Tar Command

Suppose that you have to restore a file from a TAR and put it in a different directory.
To be more clear, suppose that you have a TAR file (backup of 3 files) :

tar -tvf TARfile
/data1/file1
/data2/data/file2
/data3/file3

You need to restore file2 to /tmp/file2.tmp ?
Is it possible ? if yes How ?

Thanks a lot in advance ...

Sof

Take a look at the 'x' parameter below.

x Extract or restore. The named file s are extracted
from the tarfile and written to the directory
specified in the tarfile, relative to the current
directory. Use the relative path names of files
and directories to be extracted. If a named file
matches a directory whose contents has been writ-
ten to the tarfile, this directory is recursively
extracted. The owner, modification time, and mode
are restored (if possible); otherwise, to restore
owner, you must be the super-user. Character-
special and block-special devices (created by
mknod(1M)) can only be extracted by the super-
user. If no file argument is given, the entire
content of the tarfile is extracted. If the tar-
file contains several files with the same name,
each file is written to the appropriate directory,
overwriting the previous one. Filename substitu-
tion wildcards cannot be used for extracting files
from the archive; rather, use a command of the
form:

 tar xvf... /dev/rmt/0 \`tar tf... /dev/rmt/0 | grep 'pattern' \`

 When extracting tapes created with the  r  or  u  functions,
 directory modification times may not be set correctly. These
 same functions cannot be used with many tape drives  due  to
 tape  drive  limitations such as the absence of backspace or
 append capabilities.

Good luck