IT技术博客大学习 共学习 共进步

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

车东[Blog^2] 2019-07-26 14:08:20 浏览 1,602 次


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的一些记录 (阅读 7,740)
  2. 也说 Mac 的不好 (阅读 7,560)
  3. mac系统更换硬盘及初始化开发环境的记录 (阅读 6,481)
  4. Macbook Air换电池教程 (阅读 5,500)
  5. 在Mac OS X中运行Apache + PHP + MySQL (阅读 5,240)
  6. Mac 锁屏的各种方法 (阅读 4,800)
  7. iTerm2 (Mac Terminal) 清空当前屏幕内容 (阅读 4,701)
  8. php获取网卡MAC地址类 (阅读 4,681)
  9. Mac OS X 中的小技巧 (阅读 3,960)
  10. 8大实用又重要Mac使用技巧 (阅读 3,540)