I uploaded a windows text file and I found there are a bunch of ^M displayed. I think it is new line char, but I am wondering why ^M get displayed get displayed in this case?
Asked
Active
Viewed 883 times
2 Answers
6
^M
is the control-character representation of \r
(carriage return is ASCII 13 in decimal; M is the 13th letter of the alphabet); the \n
is displayed implicitly, as usual, by a line break.

chepner
- 497,756
- 71
- 530
- 681
1
http://vim.wikia.com/wiki/File_format
When in text editor mode (vi file.txt
) you can change the line endings using
:set ff=unix
You could be using a better text editor like Notepad++ or NetBeans which automatically use the unix line ending or at least have the ability to switch properly between them.

Daniel W.
- 31,164
- 13
- 93
- 151