Assuming GNU tar, you could
tar -xzf some.tar.gz name_of.single_file.to_extract
Assuming standard tar
zcat some.tar.gz | tar -x name_of.single_file.to_extract
- --
Lew Pitcher, IT Specialist, Corporate Technology Solutions,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEX1TpagVFX4UWr64RAuoAAKDoFa2HqxU4EMN1MAn8gg0cND5E3ACeJrZL
tyDg0KmVT91Fd4gEZfa+mBY=
=PIX9
-----END PGP SIGNATURE-----
> > Hi, is it possible to extract a single file from a .tar.gz archive?
> Yes, it is possible. Look for the -x and -f options in tar
> Assuming GNU tar, you could
> tar -xzf some.tar.gz name_of.single_file.to_extract
> Assuming standard tar
> zcat some.tar.gz | tar -x name_of.single_file.to_extract
> - --
> Lew Pitcher, IT Specialist, Corporate Technology Solutions,
> Enterprise Technology Solutions, TD Bank Financial Group
> (Opinions expressed here are my own, not my employer's)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> iD8DBQFEX1TpagVFX4UWr64RAuoAAKDoFa2HqxU4EMN1MAn8gg0cND5E3ACeJrZL
> tyDg0KmVT91Fd4gEZfa+mBY=
> =PIX9
> -----END PGP SIGNATURE-----
>> Hi, is it possible to extract a single file from a .tar.gz archive?
> Yes, it is possible. Look for the -x and -f options in tar
> Assuming GNU tar, you could
> tar -xzf some.tar.gz name_of.single_file.to_extract
> Assuming standard tar
> zcat some.tar.gz | tar -x name_of.single_file.to_extract
I don't think there's such a thing as a /standard/ tar. But for
most tars, the syntax is rather
tar xf - path/to/name_of.single_file.to_extract
(the options don't start with "-", and the default input file is
rather some tape device, so you need to give "-f -" to specify
"standard input").
Also, zcat is standardized by POSIX/Unix, but that zcat is not
supposed to recognise files compressed with gzip.
So, it should rather be:
gunzip < some.tar.gz | tar xf - path/to/file.to-extract
I think that for some tar implementations,
path/to/file.to-extract is taken as a pattern (so beware of file
paths that contain "*\?[" characters).
--
Stephane
1. Extracting a single file from a tar archive
Hi everyone,
I am trying to extract a single file from a tar archive.....However the
file that I am extracting goes to a different directory everytime I install
it...
For eg:
I type:
tar xvpf /dev/rmt/0 /x2/rws/Maxwell/diskmanbcoil/2gif-files/2bman171-shade1.gif
The file gets extracted to /x2/rws/Maxwell/diskman/coil/2gif-files
I want to have it extract to the current directory..... Can anyone help me
Thanks
Chris
--
--------------------------------------------------------------------------
- Christoper E. Olaes National Institutes of Health -
- Network Engineer Lab of Cardiac Energetics -
- -
- Telephone: 301-496-0941 Building 10, Room B1D-161A -
- FAX: 301-402-2389 Bethesda, MD 20892-1061 -
--------------------------------------------------------------------------
3. Can tar add files to .tar.gz archives ?
5. Extracting files with tar and uncompress fails with tar: Archive - EOF not on block boundary
6. ftp 421 remote service not available
7. Extracting files from multivolume tar archive made with SCO tar
8. Where should the ".." file be ?
9. using a list file to extract files from a tar archive
10. extracting a single file from a tape archive
11. Help!!How to extract tar.gz file??
12. Solaris 7 Why do extracted tar.gz show as shortened file names?
13. *.tar.gz files - how to extract ?