解决Linux下打开文本文件出现 ^M

168 阅读1分钟
# cat $FILE_NAME | tr -s "\r\n" "\n" > $NEW_FILE

这个命令好使。 究其原因是因为windows和Linux系统中文本文件的换行符不一样导致。