procmail
[Top] [All Lists]

collapsing runs of >2 blank lines to 2 (whole)

2001-11-25 12:34:39
(An incomplete version of this may have gone out; if that happened, sorry
for the duplication.)

This seemed to work:

sed -e '/[^     ]/,$ !d; :cycle' \
 -e 's/[     ]*$//; /[^\n]$/b' \
 -e 's/^\(\n\)\n*/\1/; N; b cycle'

It also kills any trailing blank lines, though.  I'm trying to think of the
simplest change to fix that.

sed -e '/[^     ]/,$ !d; :cycle' \
 -e 's/[     ]*$//; /[^\n]$/b' \
 -e 's/^\(\n\)\n*/\1/; $ P; N; $ !b cycle'

That should keep one trailing blank line (if there are any to start).



_______________________________________________
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>
  • collapsing runs of >2 blank lines to 2 (whole), David W. Tamkin <=