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

Re: search contents of a tar.gz



kmself@ix.netcom.com writes:

> On Tue, Sep 05, 2000 at 01:10:50PM +0900, Olaf Meeuwissen wrote:
> > Brian Stults <bs7452@csc.albany.edu> writes:
> > 
> > > Is there a way to search the contents of a tar.gz file withouth
> having
> > > to extract everything.  Specifically, I want to determine the
> disc-id of
> > > an audio CD, so I downloaded the freedb database in tar.gz format.
> Of
> > > course, it's a very large file.  I would like to grep the contents
> to
> > > find the CD that I'm looking for, but I don't want to extract
> > > everything.  I thought there would be a series of piped commands
> that
> > > would allow me to do it, but I can't figure it out.
> > 
> > tar -tzf file.tar.gz | grep something
> 
> Note that this requires processing the archive (including uncompressing
> it), but that data need not be stored persistantly anywhere.  This
> should fit the parameters of the request, but if the question is "can I
> avoid decompression CPU overhead, the answer is "no".

True.  I had developed a habit of first running `tar -tzf` after I got
hit by a few archives that didn't extract into their own directory and
puked all over the current one, until I found out about `tar -C`.

-- 
Olaf Meeuwissen       Epson Kowa Corporation, Research and Development



Reply to: