procmail
[Top] [All Lists]

Re: SED -- Delete successive blank lines

2000-03-06 17:39:06
Gary Hawkins explained,

| Yes I want to replace multiple blank lines with one, in .procmailrc, to
| streamline some messages before copies of them get appended to an archive
| file.

OK, thanks for clearing that up.

  :0fwbB
  * ^^()$|$$$.*$
  | sed /./,/^$/!d

That will reduce runs of multiple blank lines to one, remove any leading
blank lines in the body (except for the one that separates it from the head,
which will escape the filter because of the `b' flag), and reduce any
trailing blank lines to one.