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 ...
随机推荐
- 2017-2018-2 20155225《网络对抗技术》实验九 Web安全基础
2017-2018-2 20155225<网络对抗技术>实验九 Web安全基础 WebGoat 1.String SQL Injection 题目是想办法得到数据库所有人的信用卡号,用Sm ...
- Codeforces 1000F One Occurrence 主席树|| 离线+线段树
One Occurrence 为什么我半年前这么菜呀, 这种场只A三题... 我们在主席树 || 线段树上维护每个数的右边和它一样的数在哪里, 然后就变成了区间求最大值. 注意加进去的时候要把它右边一 ...
- Python接收执行参数
1.python内置模块sys的sys.argv函数会将解释器执行时的所有参数保存为一个列表. a.首先创建文件login.py #!/usr/bin/env python #-*- coding:u ...
- 【noip模拟赛7】上网 线性dp
描述 假设有n个人要上网,却只有1台电脑可以上网.上网的时间是从1 szw 至 T szw ,szw是sxc,zsx,wl自创的时间单位,至于 szw怎么换算成s,min或h,没有人清楚.依次给出每个 ...
- 63:二叉搜索树的第k个结点
/** * 面试题63:二叉搜索树的第k个结点 * 给定一颗二叉搜索树,请找出其中的第k大的结点 * 例如, 5 / \ 3 7 /\ /\ 2 4 6 8 中,按结点数值大小顺序第三个结点的值为4. ...
- 局域网下ARP欺骗、嗅探,以及DNS欺骗
准备:kali.xp kali ip:192.168.14.157 目标ip:192.168.14.158 目标网关:192.168.14.2 ARP欺骗:arpspoof -t 目标ip -r 目标 ...
- idea springboot热部署无效问题
Intellij IDEA 使用Spring-boot-devTools无效解决办法 springboot项目中遇到的bug <dependencies> <!--spring bo ...
- 你了解ECMAScript吗?
一.基本概念ECMA,European Computer Manufacturers Association,欧洲计算机制造协会. TC39,Technical Committee 39,ECMA的第 ...
- Javascript实现对象的创建
能使用{}创建对象就不要使用new Object,能使用[]创建数组就不要使用new Array,JS中字面量的访问速度要高于对象. 1.通过object构造函数创建单个对象 var o = new ...
- 潭州课堂25班:Ph201805201 WEB 之 Ajax第八课 (课堂笔记)
js <——>jq <!DOCTYPE html> <html lang="en"> <head> <meta charset ...