技术头条 - 一个快速在微博传播文章的方式     
您现在的位置首页 --> 其他 --> Mac下处理PC以^M结尾的文本

Mac下处理PC以^M结尾的文本

浏览:1401次  出处信息


awk -v RS='\r\n' foo.log

Unix 用\n行末结尾

Mac 用\r行末结尾

PC 用 \r\n行末结尾

参考:

https://stackoverflow.com/questions/13069905/awk-print-is-adding-a-control-m-character-at-end-of-line#comment17754368_13069905

The record separator is automatically set to the line-ending of the current system, LF (\n) on the Unix-based systems, CR-LF (\r\n) on MS systems and CR (\r) on Mac OS prior to Mac OS X.


建议继续学习:

  1. Mac下使用SecureCRT的一些记录    (阅读:7402)
  2. 也说 Mac 的不好    (阅读:7142)
  3. mac系统更换硬盘及初始化开发环境的记录    (阅读:6155)
  4. Macbook Air换电池教程    (阅读:5064)
  5. 在Mac OS X中运行Apache + PHP + MySQL    (阅读:4939)
  6. Mac 锁屏的各种方法    (阅读:4533)
  7. php获取网卡MAC地址类    (阅读:4323)
  8. iTerm2 (Mac Terminal) 清空当前屏幕内容    (阅读:4110)
  9. Mac OS X 中的小技巧    (阅读:3635)
  10. mac下的tree命令    (阅读:3296)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
© 2009 - 2025 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1