Skip to content

Instantly share code, notes, and snippets.

@yh392261226
Last active May 3, 2017 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yh392261226/007138d8aa9edf1e9dfb2a28bcf397f5 to your computer and use it in GitHub Desktop.
Save yh392261226/007138d8aa9edf1e9dfb2a28bcf397f5 to your computer and use it in GitHub Desktop.
vim: 去掉行尾的^M
1:
set fileformat=unix
2:
或者VI下使用正则表达式替换
g/\^M/s/\^M//
3:
使用sed 工具
sed ’s/^M//’ filename > tmp_filename
4:
既然window下的回车符多了‘\r’,那么当然通过删除‘\r’ ,也可以实现:
tr -d '\r'
5:
dos2unix filename
直接转换成unix格式,就OK了!~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment