procmail
[Top] [All Lists]

Re: Adding dashes to phone number in subject

2003-06-26 18:58:17
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Also sprach G.M. Wayne (Thu 26 Jun 02003 at 06:04:12PM -0700):
I receive email notification of voicemail messages, including the Caller ID
of the caller, and a MIME attachment of the voicemail. The subject looks
like this:

You have a voicemail message waiting from 12125551212

Using Procmail, I forward a copy of just the subject to my pager's email
address. However, I want the subject to contain only the phone number, so I
have written a recipe that does that:

ORIGSUB=`formail -zxSubject:`
NEWSUB=`echo ${ORIGSUB} |sed -e 's/[[:alpha:][:blank:]]//g' -e 's/1//' `
DATETIME= `date`

:0fbw
    | sed -e 'd' \
    |echo ${DATETIME}

:0w
| formail -k -X "From:" -X "Subject:" \
        -I "From: me(_at_)mydomain(_dot_)com" \
        -I "Subject: VM: ${NEWSUB} " \
        -A "X-Loop: yes" \
| $SENDMAIL mypager(_at_)mypagingcompany(_dot_)com
<snip />

SO...  What is my problem? Well, I would like to add dashes in the phone
number in the subject field to make it more readable, and I cannot figure
out how to do it with either Procmail or formail or sed.
<snip />

Does this brute force help?

        echo 1234567890 | sed 's!\(...\)\(...\)!\1-\2-!'

- -- 
Best Regards,

mds
mds resource
877.596.8237
- -
Dare to fix things before they break . . .
- -
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE++6NeLUOEaCtUQpwRAqWAAJ99IXd2QEJvt1eWF8CvokCTOTRfHgCgysnv
mf5+f8rWbqqQ1Yuyl8SZk4g=
=khfS
-----END PGP SIGNATURE-----

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail