SUMMARY: tar-grep

From: Thomas Carter (TCarter@memc.com)
Date: Mon Jun 12 2000 - 08:51:35 CDT


Thanks to all who replied. I guess I wasn't completely clear in what I
wanted to do. Many people replied with the command "tar -t <tar> | grep
<grep>", but I actually wanted to grep the contents of a file stored within
the tar ball. I recieved one workable solution that should work for me.

Peter Gutmann gave me the useful solution:
You should be able to grep the tar ball to establish if the string you are
looking for is contained in the tar ball. Then using tar get the list of
files in the tar. And then foreach file in the tar ball use gnu tar which
has the -O option (extract files to stdout) and grep the file for the
contents of the string....

Original Message:
> Sun Gurus,
>
> We archive thousands (around 10,000) of small (~1K) files into a single
> tar ball every couple of months. I now need an easy way to search for a
> specific string within one of the small files contained in the tar ball,
> determine which file it is in, and extract just that file. Due to the >
number of files, it seems too inefficient to untar the whole thing and grep
> all 10,000 files. I need tar with a grep option. Is there any utility
out > there that does this, or should I throw together something of my own?
>
> Thanks,
> Thomas Carter
> MEMC Southwest



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:09 CDT