procmail
[Top] [All Lists]

Breaking news alerts (procmail and sed)

2001-12-05 08:52:04

I've signed up for 'Breaking News' alerts from MSNBC and CNN.  I wanted to
forward them to my cell phone (which only takes 160 characters) so I came up
with a few procmail recipes that also use sed

I offer them as a thank you in case anyone else would like to do the same.

Two sed questions (GNU sed version 3.02.80)

1) the MSNBC alerts come through with

------------------------------------------------------
                MSNBC Breaking News
------------------------------------------------------

at the top of each message.  I'm getting rid of that with egrep, but if
there's a sed way to do it that would be more efficient


2) Is there a way to make
        sed '/For more details/,$d'
   case insensitive?  That would remove the need for one of the lines below


(NOTE: $CELL is previously defined as my mobile email address)

:0
* ^From: MSNBC_BreakingNews_NewsMail(_at_)MSNBC\(_dot_)COM
{
        :0 fb w
        * ^Subject:[    ]BREAKING NEWS
        | sed '/For more details/,$d' | egrep -iv  '(MSNBC Breaking News|^---)'

        :0 E fb w
        | sed '/FOR MORE DETAILS/,$d' | egrep -iv  '(MSNBC Breaking News|^---)'

        # Make the 'From' line shorter (save characters wherever you can!!)
        # and rip off the Subject line
        # and then add 'Precedence' and 'Errors-To' lines hopefully to
        # keep cell phone forwarded messages from bouncing back to the sender
        # if the cell phone is full/out of memory

        :0fhw
        |formail -I"From: MSN <nobody(_at_)msn(_dot_)com>" -I"Subject:" 
-I"Precedence:
bulk" -I"Errors-To: nobody"

        :0
        ! $CELL
}
# end msnbc

:0
* ^From:.*(mailings|BreakingNews)@(mail\.)?cnn\.com
* ^Subject:.*CNN Breaking News
{
                # Trim the fat :-)
                :0 fb w
                | sed 's/^BREAKING NEWS from CNN.com//;/Watch CNN or log 
on/,$d;s/^-- //'

                ###     Send a copy to the cell phone
                :0fhw
                |formail -I"From: CNN <nobody(_at_)cnn(_dot_)com>" -I"Subject:" 
-I"Precedence:
bulk" -I"Errors-To: nobody"

                :0
                ! $CELL
}
# end CNN




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

<Prev in Thread] Current Thread [Next in Thread>