Last active
May 3, 2017 09:27
-
-
Save yh392261226/007138d8aa9edf1e9dfb2a28bcf397f5 to your computer and use it in GitHub Desktop.
vim: 去掉行尾的^M
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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