procmail
[Top] [All Lists]

Re: blank line consolidation/strippage

2001-11-24 09:50:11
Bart suggested,

| An easier way to do the second part of that is:
|
| sed -n -e '/./,/^$/{/^$/N;p;}'
|
| That is, always print the next line after any blank line, whether that
| next line is blank or not.

I'm not so sure.  You're losing all text after the first run of two or more
blank lines, or after the first
blank line that is in an even-numbered position if you start numbering with
1 at the topmost non-blank line.

The only way in sed to consider each pair of lines together: 1 and 2, then 2
and 3, then 3 and 4 (in contrast to 1 and 2, then 3 and 4, then 5 and 6) is
to use N and D.

Sean wants to reduce all runs of three or more blank lines to two, and
that's more easily done in perl or perhaps *awk than in sed, unless, as I
posted earlier, one can be positive that the entire text will fit into sed's
hold space.


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