Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Unwanted newline or eol between fields

Reply
Thread Tools

Unwanted newline or eol between fields

 
 
Suzie Wilks
Guest
Posts: n/a
 
      03-05-2004
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!
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      03-05-2004
On Fri, 5 Mar 2004, Suzie Wilks wrote:

> Date: 5 Mar 2004 13:37:55 -0800
> From: Suzie Wilks <(E-Mail Removed)>
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse: Stripping whitespace at EOL Tim Tyler Java 7 09-15-2011 04:07 PM
replacing EOL with <br> Daves ASP .Net 1 04-13-2005 11:40 PM
3640 EOL Bill F Cisco 3 11-28-2003 08:27 PM
3640 EOL Issues Bill F Cisco 0 11-27-2003 11:39 PM
Problem with unwanted newline Andrew R. Gillett Perl Misc 1 08-07-2003 06:30 AM



Advertisments