Re: Extract file from tar home/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/09/2010 01:13 PM, Patrick O'Callaghan wrote:
> On Wed, 2010-06-09 at 00:39 -0430, Patrick O'Callaghan wrote:
>> On Tue, 2010-06-08 at 21:55 -0500, Robert Nichols wrote:
>>> There is no way other than linear search to find a file in a tar
>>> archive, so tar always has to read** from the beginning of the archive
>>> until it comes to a file you want.
>>
>> IIRC for uncompressed tarballs this is not strictly the case. The layout
>> is basically metadata-file-metadata-file-... so it's possible to seek
>> over intermediate files in strides (as the metadata includes the file
>> size). For compressed tarballs of course this won't work, which is what
>> I was trying to say.
>>
>>> Even after it has extracted everything you
>>> asked for, tar will continue to the end of the archive looking for a
>>> possible later version of one of the files you wanted, appended with a
>>> --concatenate operation after the original archive was created.
>>
>> A good point which I hadn't considered.
>
> On further reflexion and a close reading of "info tar", we find the
> following:
>
> `--occurrence[=NUMBER]'
>       This option can be used in conjunction with one of the subcommands
>       `--delete', `--diff', `--extract' or `--list' when a list of files
>       is given either on the command line or via `-T' option.
>
>       This option instructs `tar' to process only the NUMBERth
>       occurrence of each named file.  NUMBER defaults to 1, so
>
>            tar -x -f archive.tar --occurrence filename
>
>       will extract the first occurrence of the member `filename' from
>       `archive.tar' and will terminate without scanning to the end of
>       the archive.

Ah!  A much needed addition.  Looks like that option was added in
version 1.14 (May, 2004), and the fix to stop tar from scanning
through the rest of the archive even though all requested members
had already been extracted was in version 1.17 (June, 2007), so my
comment is a mere 3 years out of date.

Always something new to learn.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux