笔记 by 车东

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

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.