May I suggest that you use a proper text editor in windows. That way your text files are not stored with the windows new line rubbish on the end.

I use conText which I downloaded for free from the internet and which I can highly recommend (nothing can be too bad if it is free, but this is truely good ;)).

As to your question. I have a script loops through each line of files doing a sub for 012 and 015, replacing them with nothing. In that way you remove any newlines present. Then add an 'if' keying on $^0 eg if($^0 eq 'wnt'){..... to check the OS and add the suitable newline.

This is clunky but simple to write and quaranteed to work.

Hope that this helps.

"The significant problems we face in life can not be solved at the same level of thinking we were at when we created them." -Albert Einstein


In reply to Re: Re: newlines for windows from unix by murphya
in thread newlines for windows from unix by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.