I'm facing what I believe to one of the classic text manipulation
problems, transforming a document which was typed with a hard return at
the end of every physical line, and two consecutive newlines to mark the
end of a paragraph.

Would anyone help me write a program which would transform these
documents? I'm trying to find all instances of a single newline, and
remove it, either inserting or removing space characters around where it
was to leave just one space between what was the two lines. I also need
to substitute a single newline for two or more consecutive newlines,
whether or not they're separated by whitespace characters.

I tried looking this up in Perl Cookbook, ch. 6.6, Matching multiple
lines, but couldn't figure it out. I couldn't find a module in CPAN that
looked like it would work. I couldn't find a way to search the archives
of this group, where I bet it's been mentioned before.

Extra credit: Is it possible to do this in a one-liner?

Thanks for all your help and suggestions.

-Kevin Zembower

-----
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to