[lug] Those Pesky Newlines

Peter Hutnick peter-lists at hutnick.com
Thu Dec 26 14:26:53 MST 2002


Is there an obvious way to strip "line wrap" newlines while leaving
"paragraph separating" newlines intact?  IOW, I need to strip all the
newlines out of a file *except* ones on their own line and ones that are
on a line with text that is followed by a line that consists only of a
newline.

I'm partial to sed for this purpose, but if someone can do it in a Perl*
one-liner I'd be just as grateful.

The task at hand, in case anyone cares, is converting a Free book ("Think
Like a Computer Scientist") to weasel readers ztext format.  Paragraphs
need to be intact, but it needs to do its own wrapping.

Thanks!

-Peter

* PS: Can anyone tell me why Perl is written in proper-case, since it is
allegedly an acronym?
-P





More information about the LUG mailing list