[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] fast extract of single file from large tar.gz archive
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] fast extract of single file from large tar.gz archive |
Date: |
Fri, 15 Aug 2014 08:38:54 +0300 |
Dilip Chhetri <address@hidden> ha escrit:
> I have lots of large .tar.gz files and I need to extract just a single
> (small) file from it. I purposely put it at the front of .tar file so that
> extraction is fast, but if that file is gzipped, then 'tar' wants to read
> the whole .tgz file before exiting.
Not quite so. Tar needs to read entire file because by default it
attemts to extract all matching members from the archive, and that
behavior does not depend on whether the file is compressed or not.
If you need to extract just the first occurrence of the file, use the
--occurrence option, like that:
tar jxf linux-3.4.2.tar.bz2 --occurrence=1
linux-3.4.2/Documentation/ABI/README
Regards,
Sergey