procmail
[Top] [All Lists]

Re: How to remove multiple newlines

2004-07-15 23:26:12
On Thu, Jul 15, 2004 at 07:01:58PM -0500, David W. Tamkin wrote:
Where I had,

sed '/./,/^$/!d'

Kreemy asked,

I have to say I don't understand that syntax at all.  You have four
terms in there.

No, one term: /./,/^$/!d and no more.  If you want to understand that, 
read the sed man page.  It worked for me.

and, of course, when you feed the body you don't get the initial blank
line, right?  So all of this is to remove a closing blank line?

No, it's to collapse any runs of two or more consecutive blank lines 
into one each.  It doesn't remove the closing blank line, in fact.

Yes, it's a nice little sed statement, David.  I believe it is also
equivalent to this:

  sed -n '/./,/^$/p'

And were it not for the leading blank line that the sed statement also
nicely eliminates, it would be equivalent to this, unless I am mistaken:

  cat -s

Btw, just getting rid of the top blank could also be accomplished like so:

  tail +2

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail