On Wed, Jul 26, 2000 at 11:07:11PM -0600, SoloCDM wrote:
> > On Tue, Jul 25, 2000 at 08:42:56PM -0600, SoloCDM wrote:
> > 
> > > > SoloCDM wrote:
> > > >
> > > > > Is there an efficient way of searching tarballs for information and
> > > > > displaying the filename associated with the results?  I'm familiar
> > > > > with most of the "z" filenames (zless, zcat, ...).
...
> > >
> > > My intent is to make it automated in a bash script to search for a
> > > subject.
> > 
...
> I'm trying to get the contents within the files of the file tar-red
> and gzip-ped.  I used zcat, but it lists all the contents of all the
> files in the tar-red and gzip-ped file as one file; therefore, I'm not
> able to discern the file that goes with the information requested.

The simplest would be to untar the archives, then grep the resulting files.
You can untar to stdout, and use the verbose option (of tar) to list the
filenames, but I'm not sure how you could tell a filename from content.

  ken@moffit:/tmp
  $ tar tzvf tktraindb.tar.gz 
  drwxrwxr-x brian/brian       0 2000-05-30 06:13 traindb/
  -rwxr--r-- brian/brian   61450 2000-05-30 06:45 traindb/tktrain.pl
  -rwxr-xr-x brian/brian    3917 2000-05-30 06:10 traindb/read_traintdb.pl
  -rw-r--r-- brian/brian     520 2000-05-30 06:07 traindb/train.sql
  -rw-r--r-- brian/brian   10572 2000-05-30 06:43 traindb/tktrain_data.tdb
  -rw-rw-r-- brian/brian    2729 2000-05-30 06:43 traindb/INSTALL
  -rw-rw-r-- brian/brian      72 2000-05-30 06:44 traindb/MANIFEST
  ken@moffit:/tmp
  $ tar xOzvf tktraindb.tar.gz | grep RISK
  traindb/
  traindb/tktrain.pl
  #USE AT OWN RISK!!!
  traindb/read_traintdb.pl
  traindb/train.sql
  traindb/tktrain_data.tdb
  traindb/INSTALL
  traindb/MANIFEST

Another way might be to list the files to a Perl array, then extract
each in turn to stdout for grepping.

You might try the archive of the bash list, at moongroup.com, where
this sort of thing is discussed.

Ken

-- 
Ken Irving
[EMAIL PROTECTED]


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to