Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!agate!ucbvax!MCIRPS2.MED.NYU.EDU!karron From: karron@MCIRPS2.MED.NYU.EDU Newsgroups: comp.sys.sgi Subject: Mail organizer and indexer Message-ID: <9010190049.AA11692@mcirps2.med.nyu.edu> Date: 19 Oct 90 10:46:35 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: karron%CMCL2.NYU.EDU@cunyvm.cuny.edu Organization: The Internet Lines: 128 X-Unparsable-Date: Thu, 18 Oct 90 17:49:42 DSD Thanks for all the help from you know who out there! Here is a script I think now works nicely to index your old mail, and save your outbound mail in a crono file. Put the Mbox.sh script in your cron file to update your .mailrc and indexes at midnight every night. You can remove the reference to HOME1 and HOME2, as I have two disks to move files between. Use in good health, and now you don't have to ask on the net for repostings of stuff you have lost ! ----------------Mbox.sh---------------------------------------------------- #! /bin/sh # Macro Substitution for mbox date and folder. # Run at night to edit $HOMEDIR/.mailrc file. Run from users' crontab file, not root. # Format of crontab line: #min hour daymo month daywk cmd #0 0 * * * Mbox.sh #HOMEDIR=login homedir #HOMEDIR2=back disk homedir, second home login accnt. LOCALBIN=$HOME/bin #. Version.mac if [ -n "$1" ] then HOMEDIR=`grep "^$1" /etc/passwd | cut -d: -f6` # HOMEDIR=`dirname ${HOMEDIR}` else HOMEDIR=`grep "^${LOGNAME}" /etc/passwd | cut -d: -f6` fi if [ $HOMEDIR = /karron ] then HOMEDIR2=/usr/people/karron else HOMEDIR2=$HOMEDIR fi cd $HOMEDIR2 if [ ! -d D.Mail ] then mkdir D.Mail fi MboxFolder="$HOMEDIR2/D.Mail" MboxFile=`date "+In.%y.%m.%d"` MboxRecord=`date "+Out.%y.%m.%d"` if [ -f $HOMEDIR/mbox ] then cat $HOMEDIR/mbox >> $MboxFolder/$MboxFile rm -f $HOMEDIR/mbox fi #doe not want to take mbox as an argument!! #expects a path in /usr/ucb for EDITOR, PAGER, VISUAL PROG=' { if( $1 == "set") { if ( $2 ~ /mbox=.*$/) { print "set mbox=" MboxFolder "/" MboxFile } else if ( $2 ~ /record=.*$/ ) { print "set record=" MboxFolder "/" MboxRecord } else { print } } else print } ' nawk "${PROG}" MboxFolder=${MboxFolder} MboxFile=${MboxFile} MboxRecord=${MboxRe cord} <$HOMEDIR/.mailrc >/tmp/Mbox.mailrc.$$ mv /tmp/Mbox.mailrc.$$ $HOMEDIR/.mailrc cd D.Mail rm -f Index.In for i in `ls In.??.??.??` do ( echo (echo "from *\nx")| Mail -n -f $i| \ fgrep -v " Type ? for help." | \ fgrep -v "${DIRECTORY}/$i" |\ cut -c6-24,52- | \ sed "s/^.*/${i}|&/" echo ) >> Index.In done rm -f Index.Out for i in `ls Out.??.??.??` do ( echo (echo "set showto\nfrom * \nx")| Mail -n -f $i| fgrep -v " Type ? for help." | \ fgrep -v "${DIRECTORY}/$i" |\ cut -c6-24,52- | \ sed "s/^.*/${i}|&/" echo ) >> Index.Out done exit 0 +-----------------------------------------------------------------------------+ | karron@nyu.edu Dan Karron | | . . . . . . . . . . . . . . New York University Medical Center | | 560 First Avenue \ \ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> | | (212) 340 5210 \**\__________________________________________ | | Please Note :Soon to move to dan@karron.med.nyu.edu 128.122.135.3 (Mid Oct)| +-----------------------------------------------------------------------------+