Unwanted newline or eol between fields

Discussion in 'Perl Misc' started by Suzie Wilks, Mar 5, 2004.

  1. Suzie Wilks

    Suzie Wilks Guest

    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!
     
    Suzie Wilks, Mar 5, 2004
    #1
    1. Advertising

  2. Suzie Wilks

    Paul Lalli Guest

    On Fri, 5 Mar 2004, Suzie Wilks wrote:

    > Date: 5 Mar 2004 13:37:55 -0800
    > From: Suzie Wilks <>
    > 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
     
    Paul Lalli, Mar 5, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daves

    replacing EOL with <br>

    Daves, Apr 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    521
    Karl Seguin
    Apr 14, 2005
  2. Tim Tyler
    Replies:
    7
    Views:
    22,997
    danielson317
    Sep 15, 2011
  3. julian_m

    unwanted space between rows

    julian_m, Nov 24, 2005, in forum: HTML
    Replies:
    1
    Views:
    762
    Neredbojias
    Nov 24, 2005
  4. Xah Lee

    replacing two EOL chars by one

    Xah Lee, Dec 20, 2003, in forum: Python
    Replies:
    20
    Views:
    685
  5. Andrew R. Gillett

    Problem with unwanted newline

    Andrew R. Gillett, Aug 6, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    86
    gnarred
    Aug 7, 2003
Loading...

Share This Page