[comp.unix.shell] /usr/spool/mail filter/editor?

nichols@en.ecn.purdue.edu (Scott P Nichols) (01/17/91)

I am interested in a shell script that will, upon execution, view
the contents of the /usr/spool/mail/lname file and remove any mail
from a certain user or list of users.  I'm sure it has been done
many times, but I don't have the skills yet to write it on my own.

Anyone been hacking away at something like this?

Scott
-- 
O-        /\
|\     /\/vv\
      /vv\   \        	      __Insight from Oregon...Scott P. Nichols
_____/    \   ~~~~~~~~~~~~~~~~                      (nichols@en.ecn.purdue.edu)

edw@sequent.UUCP (Ed Wright) (01/18/91)

In article <1991Jan16.185727.15843@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
%I am interested in a shell script that will, upon execution, view
%the contents of the /usr/spool/mail/lname file and remove any mail
%from a certain user or list of users.  I'm sure it has been done
%many times, but I don't have the skills yet to write it on my own.
%
%Anyone been hacking away at something like this?

The elm mailer has a lovely set of filters.
I have found that once installed the filters keep my berzerkely mail
cleaned up too.
You can take such actions as delete, save to file , forward
based on subject who from and combinations.

Ed
-- 
 I think I've got the hang of it now .... :w  :q  :wq  :wq! ^d  X exit
 X Q  :quitbye  CtrlAltDel   ~~q  :~q  logout  save/quit :!QUIT ^[zz
 ^[ZZ ZZZZ  ^H  ^@  ^L  ^[c  ^# ^E ^X ^I ^T  ?  help  helpquit ^D  ^d
 ^C ^c helpexit ?Quit ?q  decwrl or uunet or tek !sequent!edw 

silver@xrtll.uucp (Hi Ho Silver) (01/20/91)

In comp.unix.shell, nichols@en.ecn.purdue.edu (Scott P Nichols) typed:
$I am interested in a shell script that will, upon execution, view
$the contents of the /usr/spool/mail/lname file and remove any mail
$from a certain user or list of users.  I'm sure it has been done
$many times, but I don't have the skills yet to write it on my own.

   Depending on your mailer, the easiest way to do this may well be
simply to run mail -u lname with the following redirected to its input:

d whoever-is-to-be-deleted
q

   The dumb mailer that comes with Xenix, for example, allows you to
delete messages from a person as above.  Heck, if you wanted to, you
could even put it into a here document and make about a four-line shell
script out of it.
-- 
 __            __  _  | ...!nexus.yorku.edu!xrtll!silver |  always
(__  | | |  | |_  |_) >----------------------------------< searching
 __) | |_ \/  |__ | \ | if you don't like my posts, type |    for
_____________________/  find / -print|xargs cat|compress |   SNTF

murray@motto.UUCP (Murray S. Kucherawy) (01/24/91)

nichols@en.ecn.purdue.edu.UUCP writes:
>I am interested in a shell script that will, upon execution, view
>the contents of the /usr/spool/mail/lname file and remove any mail
>from a certain user or list of users.  I'm sure it has been done
>many times, but I don't have the skills yet to write it on my own.

I can provide two alternatives:

1) "Elm" is distributed (I think) with a program called "filter",
and you write a script for it to handle certain mail a certain way as
it arrives;

2) "Mush" has the capability to do this much easier, IMHO.

I don't have shell scripts that do what you ask, but both of those mail
packages have the capacity to do what you want.

=============================== Murray S. Kucherawy ==========================
Motorola Canada, Ltd.     Communications Division, Toronto      [on work term]
University of Waterloo, Ontario, Canada               2B Math/Computer Science
Internet: murray@motto.UUCP (work)       mskucherawy@watmath.UWaterloo.ca (UW) 
UUCP:     uunet!utai!lsuc!motto!murray   uunet!watmath!mskucherawy