linux与windows格式转换

发布时间:2021-07-16 17:15:32 阅读:1270次

ctrl v enter

:1,$s/\r\\g

转:http://blog.sina.com.cn/s/blog_7226f3660100uipz.html
http://zhangabc.com/2011/08/08/vim-cr-lf-shell/
http://blog.163.com/lgh_2002/blog/static/44017526201231712755110/
DOS下的文本文件是以\r\n作为断行标志的,表示成十六进制就是0D 0A,
而Unix下的文本文件是以\n作为断行标志的,表示成十六进制就是 0A。
方法一:
1. vim hello.c  (edit the file hello.c)
2. press the key:  Esc
3. enter this string:  %s/^M//g  (^M = Ctrl v + Ctrl m)
4. press the key: enter  (the ^M cleared!)
5. :wq (save the file)
方法二:
执行命令:  dos2unix   hello.c

unix2dos job.sh
dos2unix job.sh

cat -v可以看到文件中的非打印字符,而不带-v参数的cat命令不行

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:linux与windows格式转换 出自老鄢博客 | 欢迎分享