From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <705a83eceaab3660ff85a8d46a8f96f1@vitanuova.com> To: 9fans@cse.psu.edu From: rog@vitanuova.com In-Reply-To: <99aa04dd7ad1d6871bf9e6c515b4f4fc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] spam script Date: Tue, 29 Jul 2003 18:28:50 +0100 Topicbox-Message-UUID: 09197656-eacc-11e9-9e20-41e7f4b1d025 while we're on the subject of shell scripts, if anyone is interested in building up a spam file with a view to training a bayesian filter or somesuch, here's a script that makes it easier. i haven't installed a filter yet, but i've accumulated 15MB of spam in a month and a half... it works under acme Mail; just highlight some messages and execute "spam" (assuming that's what you've named the script); alternatively execute "spam" within a message window. unfortunately it's unable to delete the messages automatically and currently it assumes it's dealing with /mail/fs/mbox. cheers, rog. PS. it was a bit of an effort to get the current selection of an acme window from within a script; it would make things easier if: - the id of the current acme window was available as well as its tag filename; - the addr file didn't revert back to its default state when the ctl file was closed; - the data file provided only the number of characters selected by the address. ... but maybe these are important properties, i dunno. #!/bin/rc rfork n fn save { {echo From spam; cat $1; echo} >> $home/spam } fn saveselected { cd $1 {echo 'addr=dot' > ctl; x=`{cat}} < addr msgs=`{>[2] /dev/null dd -count 1 -bs `{echo $x(2) $x(1) -p | dc} < data | sed -e '/^ /d' -e 's/^\(deleted\)-//' -e 's:/.*::'} for(i in $msgs) save /mail/fs/mbox/$i/raw } if(~ $#* 0 && ~ $#% 1){ if(~ $% /mail/fs/mbox/){ poss=`{awk '{print $1, $6}' < /mnt/acme/index | grep '^[0-9]+ /mail/fs/mbox/$'} if(! ~ $#poss 2){ echo no acme window found exit nope } saveselected /mnt/acme/$poss(1) } if not if(test -f $%/raw) save $%/raw } if not for(i in $*){ save /mail/fs/mbox/$i/raw }