On Sat, Feb 26, 2000 at 01:34:10PM +0100, Thomas Roessler wrote:

> I seem to recall that someone on this list wrote about some clever scripts
> to automate the use of glimpse and mutt to search huge e-mail archives.
> Any pointers?

I think I did, a long time ago.

I use this script to index my mail archives:

-- cut here ----------------------------------------------------------------
#!/bin/sh

/usr/bin/glimpseindex -o -z -H ~/Mail/archives ~/Mail/archives
-- cut here ----------------------------------------------------------------

remember to correctly set up .glimpse_filters in the target directory if you
use gzipped archives.

Then, for searching I use this:

-- cut here ----------------------------------------------------------------
#!/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 grep "^From foo@bar" > /dev/null $MBOX_FILE
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
-- cut here ----------------------------------------------------------------

Works a treat.

-- 
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

Reply via email to