- To: SLUG <slug@xxxxxxxxxxx>
- Subject: Re: [SLUG] recursive tree log grep ?
- From: James Gray <james@xxxxxxxxxxxxxxxx>
- Date: Sat, 21 May 2005 23:24:38 +1000
- Organization: GrayOnline
- Reply-to: james@xxxxxxxxxxxxxxxx
- User-agent: KMail/1.8
On Sat, 21 May 2005 11:20 pm, James Gray wrote:
> On Sat, 21 May 2005 11:12 pm, Voytek Eymont wrote:
> > I have tree like:
> >
> > /home/domain.tld/logs/
> > /home/domain2.tld/logs/
> > ...
> >
> > how do i run a grep across all logs, as in 'grep a-string /home/*/logs/*'
>
> man grep
>
> -R, -r, --recursive
> Read all files under each directory, recursively; this is
> equivalent to the -d recurse option.
>
> Makes sense when you think that a lot of Gnu tools use either -r or -R for
> recursive modifiers :) eg,
>
> for DIR in `ls -d /home/*`
> do
> grep -R a-string $DIR
> done
Oops. That script should read:
for DIR in `ls -d /home/*`
do
grep -R a-string $DIR/logs/
done
James
--
The chicken that clucks the loudest is the one most likely to show up
at the steam fitters' picnic.