procmail
[Top] [All Lists]

Re: SED -- Delete successive blank lines

2000-03-04 11:32:37
| How can I tell SED to replace any three successive paragraph marks
| (new line & carriage return) with a single one?

Gary,

First question: three consecutive ends-of-line mean two blank lines; are you
asking how to reduce any run of two or more blank lines to a single blank
line?  If you reduce them to a single end-of-line you'll lose all blank
lines, period, and get one solid block of text.  I doubt that you meant that.

Second: what do you want done with blank lines at the top of the text?
Reduce them to a single blank line if there are any, or eliminate them all?

Third: what do you want done with blank lines at the bottom of the text?
Reduce them to a single blank line if there are any, or eliminate them all?

Fourth: since you posted the question to the procmail list, may I take it
that you want to use the code in an action in a procmail rcfile?  That does
change the answer slightly.

Please let us know.