Jari Aalto asked,
| Does anyone have a handy recipe to trim empty lines
| from the beginning and from the end of message body?
| I could run the body through perl filter, but show me an
| elegant procmail solution :-)
Anything that replaces the body is going to require an outside process, even
if it's only /bin/echo.
If the entire body fits into LINEBUF, then
:0Bbfw
* ^^$*\/.(.|$)*.$
| echo "$MATCH" # trailing extra newline intended
If your version of cat is BSD-ish,
:0Bbfw
* $$$
| cat -s # SysV's cat has a different meaning for -s and cannot do this
otherwise, it can be done with a very simple sed filter:
:0Bbfw
* ^^($)|$$$
| sed /./,/^$/!d
Note that cat -s has slightly different results from the others: if there
are any empty lines at the top of the body, cat -s will keep one. The echo
and sed suggestion will remove all empty lines from the top and, like cat -s,
keep one at the bottom.