3

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?

Adam Lee
  • 23,314
  • 47
  • 144
  • 221

2 Answers2

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
  • 446,329
  • 63
  • 468
  • 610
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.
  • 29,184
  • 13
  • 85
  • 142