Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Is it possible to do some operations for files in a .tar.bz2 packaged file without unpacked it?

1 view
Skip to first unread message

Ivan Shmakov

unread,
Nov 20, 2011, 10:57:09 PM11/20/11
to
>>>>> Hongyi Zhao <hongy...@gmail.com> writes:

[Cross-posting to news:alt.sources.d, since a program posted to
news:alt.sources is referenced.]

> I've a file named exit-list-2011-11.tar.bz2, which is downloaded from
> the following url:

[...]

> Now, I want to do extract all of the IP v4 addresses in these files
> without without unpacked it? Is this possible? Any hints?

There's the --to-stdout option for GNU tar, which will simply
dump all the contents of the selected members of a .tar archive
to stdout.

Unfortunately, it doesn't work if it's necessary for the
processing step in question to discern between the individual
files, as if one wants to, e. g., compute message digests for
each of the archive's members.

There's, however, the tarmap0-is utility [1] written in Perl,
which can deal with precisely this case. Consider, e. g.:

$ tar -C /bin -c -- bash dash \
| tarmap0-is bash -c 'sha1sum | sed -e s/-\$/"$FILE"/'
bash
add19e504c254758f2ea8dcda3821c77fafb4923 bash
dash
7f123974c1814d026a26e79981453881efb49916 dash
$

(There's also an open https://rt.cpan.org/ ticket on developing
a more generic ptarsplit(1) tool [2].)

[1] news:87d3d6b...@violet.siamics.net
[2] https://rt.cpan.org/Ticket/Display.html?id=72219

--
FSF associate member #7257
0 new messages