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 |