Unwanted newline or eol between fields

S

Suzie Wilks

This seems so simple, but it's driving me crazy.

I have a file that looks a bit like this:

-0.15 -0.15 -0.20
-0.20 -0.20 -0.15
-0.15 -0.15 -0.15


0.002
0.007
0.038

But I'd like it to be:

-0.15 -0.15 -0.20
-0.20 -0.20 -0.15
-0.15 -0.15 -0.15
0.002 0.007 0.038

(Empty lines between lines are ok. ) I guess I'm supposed to get rid
of a newline if the next line starts with whitespace, but my regexps
just aren't doing it. (Or get rid of a newline if it's followed by
whitespace?)

Any thoughts?
Thanks very much!
 
P

Paul Lalli

Date: 5 Mar 2004 13:37:55 -0800
From: Suzie Wilks <[email protected]>
Newsgroups: comp.lang.perl.misc
Subject: Unwanted newline or eol between fields

This seems so simple, but it's driving me crazy.

I have a file that looks a bit like this:

-0.15 -0.15 -0.20
-0.20 -0.20 -0.15
-0.15 -0.15 -0.15


0.002
0.007
0.038

But I'd like it to be:

-0.15 -0.15 -0.20
-0.20 -0.20 -0.15
-0.15 -0.15 -0.15
0.002 0.007 0.038

(Empty lines between lines are ok. ) I guess I'm supposed to get rid
of a newline if the next line starts with whitespace, but my regexps
just aren't doing it. (Or get rid of a newline if it's followed by
whitespace?)

Any thoughts?
Thanks very much!

So, what regexps have you tried? How did they not get the job done? What
did they do you didn't expect them to do, or vice-versa?

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top