procmail
[Top] [All Lists]

RE: SED -- Delete successive blank lines

2000-03-04 23:36:07
-----Original Message-----
From: David W. Tamkin [mailto:dattier(_at_)mcs(_dot_)net]
Sent: Saturday, March 04, 2000 10:28 AM
To: Gary Hawkins
Cc: procmail mailing list
Subject: Re: SED -- Delete successive blank lines


| 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.


My mistake.  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.

Thanks for the response.

Gary H.