Thursday, November 20, 2008

New Web Note

Convert ^M to newline character in text files

If the ^M character is showing up in files while opening the file concerned, then follow these steps to convert it to a new line.
In vi use the following:


^M is ASCII 13 (Ctrl M), which is the carriage return.

Different operating systems use different symbols to set the end of a line/new line.
Unix uses newline (\n)
Mac uses carriage return (\r)
And Windows/DOS use both (\n\r)

To prevent the ^M from showing up in files, be sure to use the ASCII (text) mode when transfering text files.


Use this command : dos2unix <file name>

No comments: