SUMMARY: Extracting Single File from Tarball

From: Fiengo, Paul (Contractor) <FiengoP_at_ritchie.disa.mil>
Date: Wed Jun 02 2004 - 09:42:18 EDT
All,

Thank you for your many responses.  Many of you responded with the fact that
the information I am looking for IS in the man pages.  I will have to verify
this, but I am sure you are all right. Dave pointed out...

Huh? From the Solaris 8 tar manpage:


     tar x  [  BefFhiklmnopqvwX  [ 0-7  ]   ]   [  tarfile  ]   [
     exclude-file ]  [ file ... ]

     x     Extract or restore. The named files are extracted from
           the  tarfile

In addition, many of you said to use an exclude file.  Ryan says...

The only way I know how to do it is to create an exclude file.  So you
generate a list of the files in the tarball using 'tar tf mytarball.tar >
excludefile'

Remove the path(s) / file(s) you want extracted from the exclude file

Then extract:

tar xf mytarball.tar excludefile

Be sure that if your tarball has a directory structure, you allow for
those to be created to.

For example if you want the file testdir/myfile, you must remove testdir/
and testdir/myfile in the exclude file.  The testdir/ in a excludefile
essentially means testdir/*, so none of the files get created.

Most of you, however, provided me with a straight example.  Jeff's example
is...

It's pretty simple. You just need to specify the path of the file you're
extracting:

If you have tarball foo.tar and you want to extract the file
./foo/fi/fum/file.txt, do this: tar xvf foo.tar ./foo/fi/fum/file.txt

I didn't have a tar file name per say.  I tar'ed everything up to a tape.
Thus I used...

tar xvf /dev/rmt/0 filename

Again, THANK YOU all for the responses.  I was successful.

Paul


>  -----Original Message-----
> From: 	Fiengo, Paul (Contractor)  
> Sent:	Tuesday, June 01, 2004 3:46 PM
> To:	'sunmanagers@sunmanagers.org'
> Subject:	Extracting Single File from Tarball
> 
> Gurus:
> 
> I am wanting to extract two files from a tar archive that I created.  Is
> this possible?  If so, how?  Unix man pages / google are not producing any
> solutions.  I am running Solaris 8 on a 280R.  Will summarize.
> 
> Thank You,
> 
> Paul Fiengo
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Jun 2 09:42:12 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:32 EST