[Top] [All Lists]

Stripping extra stuff from text

2015-04-29 11:34:10
I have the following which generates a 140 character blog for sending me an SMS 

MSGTEXT=`/usr/local/bin/formail -I ""`
SMSTEXT=`echo $MSGTEXT | lynx --dump --dont_wrap_pre -stdin | tr '\n' ' ' | 
/usr/bin/cut -c1-140`

      | (formail -brt -I"Subject: ${CLEANFROM}" \
        -I"To: ${MOBILE}" \
        -I"From: lbuter(_at_)kreme(_dot_)com"; \
        echo $SMSTEXT) | $SENDMAIL -t

This works fine, but I end up with text like:

SMS:    This is the body of the email. It should be more than 140 characters to 
   = test if the cut pipe is working and if this message will be 

As you can see, I have leading spaces, and an extraneous =, but if I remove 
lynx from the chain, I will get HTML crap in the message on those messages.

Is there a simple way to remove any extra space AND encoding cruft, or do I 
just need to stack up some tr or sed pipes? 

"Why, you stuck-up, half-witted, scruffy-looking... NERFHERDER!"
"Who's Scruffy looking?"

procmail mailing list   Procmail homepage:

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