unpacking one single file from archive

Paal Marker paal at barum.folkebibl.no
Thu Jan 20 08:30:20 UTC 2005


C. Linus Hicks wrote:

>On Wed, 2005-01-19 at 07:04 -0600, Rigler, Stephen C. wrote:
>  
>
>>If the archive, "x.tar.gz", has a file that you want called "z.doc"
>>then if you only want to extract the one file do:
>>
>>tar xvzf x.tar.gz z.doc
>>    
>>
>
>This is true, AND you must match the path as stored in the archive. So
>for example, if you have an archive with:
>
>xyz/1.abc
>
>Then you must use:
>
>tar xf x.tar xyz/1.abc
>
>  
>
Yes, that was where I missed it,  unpacking a file under home/user I did 
it by habit writing  /home/user.....one slash to much.......thank u very 
much.

Another question is search for a file in a tar.gz archive.  Now I do it 
in a heavy way in two steps, first make a file I can search in and then 
make the search: 

less y.tar.gz  |  cat >  readfile    
grep -n "x.doc" readfile

.......and I get the file with full path.

I believe there is a command for searching directly for a file and path 
in a tar.gz archive, but wich one is it?











More information about the redhat-list mailing list