What is `^M` and how do I get rid of it?
When I open the file in vim, I am seeing strange ^M characters.
Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here:
What is this
^Mcharacter?How could it have gotten there?
How do I get rid of it?
he ^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.
dos2unix filename
This command works with path patterns as well, Eg
dos2unix path/name*
If it doesn't work, try using different mode:
dos2unix -c mac filename
-c Set conversion mode. Where CONVMODE is one of: ascii, 7bit, iso, mac with ascii being the default.
:e ++ff=dos
The :e ++ff=dos command tells Vim to read the file again, forcing dos file format. Vim will remove CRLF and LF-only line endings, leaving only the text of each line in the buffer.
then
:set ff=unix
and finally
:wq
What is `^M` and how do I get rid of it?的更多相关文章
- SQL Server镜像自动生成脚本
SQL Server镜像自动生成脚本 镜像的搭建非常繁琐,花了一点时间写了这个脚本,方便大家搭建镜像 执行完这个镜像脚本之后,最好在每台机器都绑定一下hosts文件,不然的话,镜像可能会不work 1 ...
- 恢复SQL Server被误删除的数据
恢复SQL Server被误删除的数据 <恢复SQL Server被误删除的数据(再扩展)> 地址:http://www.cnblogs.com/lyhabc/p/4620764.html ...
- 记一次SQLServer的分页优化兼谈谈使用Row_Number()分页存在的问题
最近有项目反应,在服务器CPU使用较高的时候,我们的事件查询页面非常的慢,查询几条记录竟然要4分钟甚至更长,而且在翻第二页的时候也是要这么多的时间,这肯定是不能接受的,也是让现场用SQLServerP ...
- 我为NET狂官方面试题-数据库篇答案
题目:http://www.cnblogs.com/dunitian/p/6028838.html 汇总:http://www.cnblogs.com/dunitian/p/5977425.html ...
- SQL必备知识点
经典SQL语句大全 基础 1.说明:创建数据库.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备份数据的 device.说明:创建新表crea ...
- Android Ormlite 学习笔记2 -- 主外键关系
以上一篇为例子,进行主外键的查询 定义Users.java 和 Role.java Users -- Role 关系为:1对1 即父表关系 Role -- Users 关系为:1对多 即子表关系 下面 ...
- 安卓自定义组合控件--toolbar
最近在学习安卓APP的开发,用到了toolbar这个控件, 最开始使用时include layout这种方法,不过感觉封装性不好,就又改成了自定义组合控件的方式. 使用的工具为android stud ...
- SQL Server中SELECT会真的阻塞SELECT吗?
在SQL Server中,我们知道一个SELECT语句执行过程中只会申请一些意向共享锁(IS) 与共享锁(S), 例如我使用SQL Profile跟踪会话86执行SELECT * FROM dbo.T ...
- 运用Mono.Cecil 反射读取.NET程序集元数据
CLR自带的反射机智和API可以很轻松的读取.NET程序集信息,但是不能对程序集进行修改.CLR提供的是只读的API,但是开源项目Mono.Cecil不仅仅可以读取.NET程序集的元数据,还可以进行修 ...
- Lesson 22 A glass envolops
Text My daughter, Jane, never dreamed of receiving a letter from a girl of her own age in Holland. L ...
随机推荐
- PTA之多项式求值
时间限制: 400ms 内存限制: 64MB 代码长度限制: 16KB 函数接口定义: double f( int n, double a[], double x ); 其中n是多项式的阶数,a[]中 ...
- ubuntu16系统中pycharm下使用git将代码提交到github仓库
1 在系统中安装git,在terminal中输入以下命令 sudo apt-get update sudo apt-get install git 2 对git进行配置,在terminal中输入以下命 ...
- kms可用激活服务器地址|kms可用激活服务器分享
kms可用激活服务器地址|kms可用激活服务器分享 kms可用激活服务器地址都有哪些呢?使用kms激活服务器激活windows和office是微软提供的激活方式之一.kms激活服务器普遍由个人或企 ...
- hdu 2005 求第几天(水题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2005 转载于:https://blog.csdn.net/tigerisland45/article/ ...
- Linux学习之常用文件处理命令(一)
(一)文件命名规则 (二)常用文件处理命令 1.ls命令 2.cd命令 3.pwd命令 4.mkdir命令 5.touch命令 6.cp命令 7.mv命令 8.rm命令 9.cat命令 10.more ...
- Nodejs学习之mongodb Error: failed to connect to [localhost:27017]
在连接mongodb时出现以下错误提示信息 events.js: throw er; // Unhandled 'error' event ^ Error: failed to connect to ...
- spring中整合ssm框架注解版
和xml版差不多,只不过创建对象的方式是由spring自动扫描包名,然后命名空间多一行context代码在application.xml中,然后将每个对象通过注解创建和注入: 直接上代码: 1.use ...
- 深度学习中 droupout层是咋回事??
参考这篇博文 博主写的非常好! https://blog.csdn.net/program_developer/article/details/80737724 参考这篇博文 博主写的非常好! ...
- loj#2012. 「SCOI2016」背单词
题目链接 loj#2012. 「SCOI2016」背单词 题解 题面描述有点不清楚. 考虑贪心 type1的花费一定不会是优的,不考虑, 所以先把后缀填进去,对于反串建trie树, 先填父亲再填儿子, ...
- Shiro笔记(三)授权
Shiro笔记(三)授权 一.授权方式 1.编程式: Subject subject=SecurityUtils.getSubject(); if(subject.hasRole("root ...