views:

38

answers:

2

I am putting an old website up on a new server and i've noticed various issues. Firstly, if i look at any of the files locally they all have double line spacing - anywhere there is a newline there has also been a blank line inserted. This is the same in netbeans and notepad++. Then, when i SFTP the files to the server and view them in Vi i see ^M at the end of each line. The final thing is that when i'm having issues making the site actually work, i've tracked this down to a common includes.php file which when i view it has been converted to a single line of code - i can still see ^M but there isnt a single newline in there. at the bottom of vi it actually says: "includes.php" [noeol]

I'm working locally on windows, i do have a Mac aswell i could try things on. My remote server is running Ubuntu 9

Please let me know if this question would be better on serverfault

A: 

Snaken, had the same exact thing happen to me last night. I think I chalked it up to Netbeans, because it's never manifested itself in Notepad++ in several years of use. Good news is that if you open in notepad++ and re-do the returns, the tabs will reset themselves without fail. The bad news is that this is manual. For me, it was only three files, so no biggie.

This explains how to remove the ^m from line end: http://www.tech-recipes.com/rx/150/remove-m-characters-at-end-of-lines-in-vi/

bpeterson76
+3  A: 

Run the files through any of a number of standard utilities and save yourself a lot of time. I think dos2unix is usually on most distributions. If not it should be in a repository somewhere.

(Yes, this probably a serverfault question IMO.)

Duck
yep, `todos` and `fromdos` are lifesavers in these situations.
no