On Thu, Jun 22, 2000 at 07:59:55AM -0400, David T-G wrote:
> Dave --
> 
> % grepmail wrapper that does all this for you. I've got something similar that
> % I use with glimpse. It does the search and, if something was found, it fires
> % up mutt with all the found messages in a folder. It ever writes a short
> % muttrc file that sets up colours so that the target words are highlighted.
> 
> What a cool idea.  Care to share it?

My pleasure, on the understanding that installing and using glimpse is left
as an exercise for the reader. <g>

All my mail archives live in ~/Mail/archives and are gzipped (don't you just
love the compressed folders patch?). The first attached file (mboxindex) is
run from a cron job once a week.

Then, to do the search, I simply use the attached mboxfind. It isn't perfect
but it does most of what I need.

-- 
Take a look in Hagbard's World: | mutt.octet.filter - autoview octet-streams
http://www.hagbard.demon.co.uk/ | mutt.vcard.filter - autoview simple vcards
http://www.acemake.com/hagbard/ | muttrc2html       - muttrc -> HTML utility
Free software, including........| muttrc.sl         - Jed muttrc mode
#!/bin/sh

/usr/bin/glimpseindex -o -z -H ~/Mail/archives ~/Mail/archives
#!/bin/sh

MBOX_FILE=/tmp/mboxfind.results.$$
MUTTRC_FILE=/tmp/mboxfind.muttrc.$$

echo "Searching, please wait a moment..."
glimpse -z -y -w -i -h -H ~/Mail/archives -d "^From " -e "$1" | formail -b > $MBOX_FILE

if head $MBOX_FILE | grep "^From foo@bar" > /dev/null
then
    echo "No matches found"
else
    echo "color body brightwhite red \"($1)\"" | sed -e 's/;/|/g'  > $MUTTRC_FILE
    echo "mono  body bold \"($1)\"" | sed -e 's/;/|/g'            >> $MUTTRC_FILE
    echo "source ~/.muttrc"                                       >> $MUTTRC_FILE
    echo "bind pager c noop"                                      >> $MUTTRC_FILE
    echo "bind index c noop"                                      >> $MUTTRC_FILE
    mutt -R -F $MUTTRC_FILE -f $MBOX_FILE
fi

rm -f $MBOX_FILE $MUTTRC_FILE

Reply via email to