1863059 Members
1029 Online
110446 Solutions
New Discussion

Re: About tar

 
SOLVED
Go to solution
juno2
Super Advisor

About tar

I used the tar command "tar -zcvf " to backup some files ( eg. file a , file b , file c , file d ... ) to a .tgz file , is it possible to extract one of file in this tgz file instead to use "tar -zxvf" to extract all the files ? thx
3 REPLIES 3
Tom Geudens
Honored Contributor
Solution

Re: About tar

Hi,
tar -zxvf nametar.tgz filea
should do the trick ?

Regards,
Tom
A life ? Cool ! Where can I download one of those from ?
Paula J Frazer-Campbell
Honored Contributor

Re: About tar

Hi


Try perl

perl -MGT::Tar -le 'GT::Tar->untar("/path/to/tar/file", sub { return unless $_->name eq "file_you_want_to_extract"; $_->name("new/path/to/save"); $_->write; })'


Paula
If you can spell SysAdmin then you is one - anon
Mark Grant
Honored Contributor

Re: About tar

juno2,

This is perfectly possible. "tar zxvf archive.tgz filename". You can have more than one filename so can extract several files at once and if the filename is a directory, it will extract all the files in the directory.

Personally I'd go for Paula's method because then you really can call yourself a totally whacked out perl maestro!
Never preceed any demonstration with anything more predictive than "watch this"