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

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

浏览:517次  出处信息


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的一些记录    (阅读:6404)
  2. 也说 Mac 的不好    (阅读:6106)
  3. mac系统更换硬盘及初始化开发环境的记录    (阅读:5230)
  4. 在Mac OS X中运行Apache + PHP + MySQL    (阅读:4236)
  5. Macbook Air换电池教程    (阅读:3963)
  6. Mac 锁屏的各种方法    (阅读:3592)
  7. php获取网卡MAC地址类    (阅读:3403)
  8. mac下的tree命令    (阅读:2913)
  9. Mac OS X 中的小技巧    (阅读:2801)
  10. 不一样的交互组件(上)    (阅读:2445)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1