procmail
[Top] [All Lists]

Re: blank line consolidation/strippage

2001-11-25 10:27:44
Sean wrote a line that got wrapped into this (I won't insert backslashes
because some of the email-transport-forced line breaks come in places where
backslash-newline wouldn't work):

 |sed -e
 '/^[    ]*$/{;s/[       ]*//;N;/^\n[    ]*$/{;s/^\(\n\)\([
 ]*\)$/\1/;:nexblank;N;/^\n\n[   ]*$/{;s/^\(\n\)\(\n[    ]*\)$/\1/;t
 nexblank;};};}'

| Thanks to the input from several people here, it's working.  ...
| Semicolons saved the day, as seen above.

What surprises me is that two of those semicolons work.  The seds I've used,
if they grok semicolons at all, require that label names and t and b
instructions (even if they have no label names as targets and implicitly
branch to the end) must be terminated by actual newlines or, if given on
sed's command line, by termination of the positional parameter (such as
unquoted whitespace or an unquoted shell metacharacter).  So, with the
difficulties of including quoted newlines when sed is invoked within a
procmail rcfile, it would be necessary to close the apostrophes and start a
fresh -e option instead of using a semicolon after each of the appearances
of "nextblank" there.



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