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

Note the use of a "for ; do ; done" loop - this is necessary because you've 
used two wild cards in your original example.  Using the loops breaks the 
two while loops up.  Read the man page for grep.

James
-- 
Writing software is more fun than working.

Attachment: pgpaiwHTOsrrO.pgp
Description: PGP signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to