Stripping extra stuff from text
"@lbutlr" <[email protected]> Wed, 29 Apr 2015 10:30:39 -0600
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
I have the following which generates a 140 character blog for sending me an SMS alert:
MSGTEXT=`/usr/local/bin/formail -I ""`
SMSTEXT=`echo $MSGTEXT | lynx --dump --dont_wrap_pre -stdin | tr '\n' ' ' | /usr/bin/cut -c1-140`
:0c
| (formail -brt -I"Subject: ${CLEANFROM}" \
-I"To: ${MOBILE}" \
-I"From: [email protected]"; \
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?"