3 回答
TA贡献2065条经验 获得超13个赞
tr
tr -d '\015' <DOS-file >UNIX-file
DOS-file
UNIX-file
sed 's/^M$//' # DOS to Unixsed 's/$/^M/' # Unix to DOS
bash
sed $'s/\r$//' # DOS to Unixsed $'s/$/\r/' # Unix to DOS
dos2unix
unix2dos
dtou
utod
TA贡献1811条经验 获得超4个赞
tr -d "\r" < file
sed
:
# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.
sed 's/.$//' # assumes that all lines end with CR/LF
sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M
sed 's/\x0D$//' # works on ssed, gsed 3.02.80 or higher
# IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format.
sed "s/$/`echo -e \\\r`/" # command line under ksh
sed 's/$'"/`echo \\\r`/" # command line under bash
sed "s/$/`echo \\\r`/" # command line under zsh
sed 's/$/\r/' # gsed 3.02.80 or higher
sed -i
sed -i 's/..../' file
.
- 3 回答
- 0 关注
- 1870 浏览
添加回答
举报