TAR help .....

C M Reinehr cmr at amsent.com
Thu Jan 22 12:28:35 PST 2009


Ben,

On Thu 22 January 2009 14:10, Ben Duncan wrote:
> Ok, I have a tar file. When you tzr tvzf , you have a list that shows
> something like :
> ....
> ......
> export/usr1/thisdir/afile
> export/usr1/thisdir/MYFILE
> .....
> ......
> ....... (and so one ..)
>
> and you want to extract ONLY MYFILE and you want it extracted
> in the directory you are in and NOT the WHOLE tree
> How do you do that ?

The option ‘--strip-components=number’ looks like it might fit your needs. 
(http://www.gnu.org/software/tar/manual/html_node/Option-Summary.html#SEC42)

Strip given number of leading components from file names before extraction. 
For example, if archive ‘archive.tar’ contained ‘/some/file/name’, then 
running 
 
  tar --extract --file archive.tar --strip-components=2

  would extract this file to file ‘name’.

HTH

cmr
-- 
Debian 'Etch' - Registered Linux User #241964
--------
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC




More information about the Linux-users mailing list