Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jun 2000 19:58:48 -0500
From:      David Vondrasek <david@davidv.net>
To:        questions@FreeBSD.ORG
Subject:   grep / zgrep help
Message-ID:  <200006200100.UAA07480@ns1.davidv.net>
In-Reply-To: <00062110360903.00320@desktop.freebsd.org>
References:  <200006191448.SM00167@pop.sby.globalinfo.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Im trying to create a search tool to locate text on a CD. The directory
tree is very *deep*
I know the basic zgep expression to grep one file or " * " for all files,
even add a -r to get the full tree..  But geezzz this takes almost an hour
for the full tree when All I need is one file in each directory to be
searched.. Can any one help with a expression line here ?

Here is what I have now and the output goes to a webpage.

$4 = the string you are looking for input from the form on the webpage

/usr/bin/zgrep "$4" /cdrom/mail/radius/jan2000/31_1205/ghtdfw/billing.gz

A normal tree looks as such

root@abuse5:/cdrom/mail/radius/jan2000 : ls -la
total 137
dr-xr-xr-x  64 root  wheel  8192 Feb  9 08:05 .
dr-xr-xr-x   3 root  wheel  2048 Feb  9 03:37 ..
dr-xr-xr-x  10 root  wheel  2048 Dec 31 18:08 01_0005
dr-xr-xr-x  10 root  wheel  2048 Jan  1 06:07 01_1205
dr-xr-xr-x  10 root  wheel  2048 Jan  1 18:09 02_0005
dr-xr-xr-x  10 root  wheel  2048 Jan  2 06:07 02_1205

2 directories for each date with 12 hours woth of logs in each directory.

deeper still is :

root@abuse5:/cdrom/mail/radius/jan2000/01_0005 : ls -la
total 46
dr-xr-xr-x  10 root  wheel   2048 Dec 31 18:08 .
dr-xr-xr-x  64 root  wheel   8192 Feb  9 08:05 ..
dr-xr-xr-x   2 root  wheel   2048 Dec 31 18:04 cor
dr-xr-xr-x   2 root  wheel   2048 Dec 31 18:04 den
dr-xr-xr-x   2 root  wheel  22528 Feb  9 08:06 detail
etc ....

and deeper  the last directory

root@abuse5:/cdrom/mail/radius/jan2000/01_0005/den : ls -la
total 40
dr-xr-xr-x   2 root  wheel   2048 Dec 31 18:04 .
dr-xr-xr-x  10 root  wheel   2048 Dec 31 18:08 ..
-r--r--r--   1 root  wheel    326 Feb  9 11:30 TRANS.TBL
-r--r--r--   1 root  wheel   1332 Dec 31 18:05 active.gz
-r--r--r--   1 root  wheel  35072 Dec 31 18:05 billing.gz
-r--r--r--   1 root  wheel     25 Dec 31 18:05 dead.gz
-r--r--r--   1 root  wheel     26 Dec 31 18:05 deads.gz
-r--r--r--   1 root  wheel     44 Dec 31 18:05 marks.gz
-r--r--r--   1 root  wheel     46 Dec 31 18:05 reasons.gz
-r--r--r--   1 root  wheel   1402 Dec 31 18:05 usage.gz

The ONLY file that needs to be look at in each tree is the " billing.gz "
file.

I need to be able to issue a command in
/cdrom/mail/radius/

and have it JUST searcjh though the billing.gz files in each subtree below.
This should cut my search time to about 1/20 of the time it does now with

/usr/bin/zgrep "$4" /cdrom/mail/radius/jan2000/ *

help from any of you script gods ? and please don't say

" man zgrep " I've read it and tried everything I know from it.

Thanks


David Vondrasek

http://www.davidv.net



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006200100.UAA07480>