[Scottish] Best way to find text within files recursively?

David Marsh's list-reading hat scottish at mailman.lug.org.uk
Sat Jan 18 14:51:01 2003

Hi folks,

OK, this is hopefully a fairly easy one, but despite being a user for
several years, I've still never got round to investigating the more
complex aspects of the shell..

Unfortunately, a while back I somehow accidentally managed to setup a
mail processing rule within my mailer which gradually moved all of my
older messages to the trash (when I only meant to apply this to one
particular folder), and a number of messages vanished before I noticed
this :-(

"Luckily" I do make (random [1]) backup copies of my mail folders now
and again elsewhere on my hard disk just to be on the safe side (getting
my cd-writer working under Linux is still on the "to-do" list, sadly),
so hopefully I still have most of these messages somewhere.
([1] Yes, must investigate proper automated backups, too)

What I want to do is, cd into the mail backup directory, 
and then recursively search through the folders (MH type) looking for
particular text strings, eg, something like:

for (every folder in this directory)
	grep -l myfriend@somewhere.org *

but I don't know what the syntax for that is 
(whether it be bash, perl, whatever)

I'm sure this is one of these moronically stupid questions that is
probably answered on some 'quick-reference' website somewhere, but I
just don't know where to start..

Can anybody help me out with this (without berating me for being too
stupid/lazy)? ;-)

Many thanks for any help,


David Marsh, <email valid @time of writing> | http://web.viewport.co.uk/