[net.unix] Mail Filters Needed

adamm%bbn-unix@sri-unix.UUCP (01/05/84)

From:  Adam Moskowitz <adamm@bbn-unix>

  I have need for a mail filter that will allow me
to 'standardize' the 'Date:' field in my mailbox.
I'd like to be able to either remove the 'Day,',
or insert the appropriate day or both.  If you
have or know of such a filter, please let me know.
SH or CSH scripts are fine, C progs are also good.

Thanx,
AdamM
(adamm@bbn-unix)

jeff@heurikon.UUCP (01/06/84)

I've used 'sed' numerous times to make a filter of the type
you described ("Modify the Date field of a msg...").

For example, the following filter will force a particular machine
name to occupy the first position in a 'path' header:

	sed -e "s/^Path: foo!/Path: /" -e "s/^Path: /&foo!/"

In this case, if 'foo' is already at the beginning of the path it
removes it, then it adds 'foo' - thus assuring there is always one
'foo' (and only one) at the front of the path.

You could use 'sed' to adjust the date field in a similar fashion.
You may need a number of -e fields to cope with the various days
of the week (or one 'sfile'), but sed is very flexible - and it's fast.
Try it, you'll like.

Another idea: If all you need to do is *remove* a particular field from
a line, then you could feed the line in question to 'cut' and have it
deliver only the fields of the line you want.
-- 
	Jeffrey Mattox, Heurikon Corp, Madison, WI
	{harpo, hao, philabs}!seismo!uwvax!heurikon!jeff  (news & mail)
		ihnp4!uwvax!heurikon!jeff  (mail)
	(Those paths are correct, despite what the headers might show.)