linux
和
window
之间文本转换时,由于换行表示不一致,会出现黑色方块或者
^M
之类的麻烦
在 linux 上可以装 tofrodos 来解决这个问题,也可以使用 sed 命令。
相关的命令:
dos2unix file 等价于 sed -i'' "s/\r//" file
unix2dos file 等价于 sed -i'' "s/$/\r/" file
其中 -i 后面的是单引号组成 ,适用 GNU sed, FreeBSD 下的 sed 不适用
在 linux 上可以装 tofrodos 来解决这个问题,也可以使用 sed 命令。
相关的命令:
dos2unix file 等价于 sed -i'' "s/\r//" file
unix2dos file 等价于 sed -i'' "s/$/\r/" file
其中 -i 后面的是单引号组成 ,适用 GNU sed, FreeBSD 下的 sed 不适用
转载于:https://blog.51cto.com/donex/772682