DOS与UNIX文件风格互转
DOS文件行以\r\n结尾,UNIX文件行以\n结尾。
DOS --> UNIX :
sed 's/.$//g' dosfile > unixfile
tr -d "\r" dosfile > unixfile
UNIX --> DOS :
sed 's/$/\r/g' unixfile > dosfile
本文介绍如何在DOS和UNIX文件风格间进行转换。DOS文件使用
作为行结束符,而UNIX文件则使用
。文中提供了使用sed和tr命令的具体方法。
DOS文件行以\r\n结尾,UNIX文件行以\n结尾。
DOS --> UNIX :
sed 's/.$//g' dosfile > unixfile
tr -d "\r" dosfile > unixfile
UNIX --> DOS :
sed 's/$/\r/g' unixfile > dosfile

被折叠的 条评论
为什么被折叠?