What is `^M` and how do I get rid of it? - Unix Linux Stack Exchange The ^M is a carriage-return character If you see this, you're probably looking at a file that originated in the DOS Windows world, where an end-of-line is marked by a carriage return newline pair, whereas in the Unix world, end-of-line is marked by a single newline
Vim 中如何去掉 ^M 字符? - 知乎 如果win下的文档上传到linux,每行的结尾都会出现一个^M,(^M是ctrl+v,ctrl+m) 如果是单个文档的话,可以用vi打开,执行 :%s ^M g 来去掉^M, 但如里批量去除的话就不能用vi了, 方法1: 用dos2unix工具, 把win文档转换成linux下文档 命令: find -type f -print0 | xargs -0 dos2unix