Why does \ r \ n appear as ^ M in vi?

I downloaded a windows text file and I found that a bunch of ^ M is displayed. I think it is a newline char, but I am wondering why the display M is displayed in this case ??

+3


source to share


2 answers


^M

is the representation of the control character \r

(carriage return is ASCII 13 decimal, M is the 13th letter of the alphabet); \n

displayed implicitly, as usual, by line breaks.



+5


source


http://vim.wikia.com/wiki/File_format

In text editor ( vi file.txt

) mode, you can change line endings using



:set ff=unix

      

You can use a better text editor like Notepad ++ or NetBeans that automatically uses the unix line ending, or at least has the ability to switch between them correctly.

+1


source







All Articles