procmail
[Top] [All Lists]

Re: How to remove multiple newlines

2004-07-15 15:37:15
On Wed, 14 Jul 2004 21:36:02 -0500, David W. Tamkin 
<dattier(_at_)panix(_dot_)com> wrote:
Sean's said a lot of the things I wanted to, such as dropping the
trailing .* from the condition, but here are some more:

Probably what you're looking for is:

sed -e '/^$/d'

That would remove all blank lines.  Try

In the described case removing all blanks would be a God Thing(tm). 
However, in the interest of science removing only the first and
trailing blanks is a good exercise

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

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

Wasteful to run formail there as a way to get rid of the head (and yet,
to keep the unwanted blank line at the neck); just use the `b' flag to
feed only the body to the action:

  :0b:
  * ^Subject:.*todo
  | sed '/./,/$/!d' >> $HOME/todo # \!d if $SHELL is csh or csh-like

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?

-- 
gkreme at gmail or kreme at kreme or syth at mac

____________________________________________________________
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