3 回答
TA贡献1827条经验 获得超8个赞
\R
\R
s/\R$/\n/
\n
s/\R/\n/g
\n
$ printf "what\risgoingon\r\n" > file $ od -c file0000000 w h a t \r i s g o i n g o n \r \n0000020
\R
$
$ perl -pe 's/\R$/\n/' file | od -c0000000 w h a t \r i s g o i n g o n \n 0000017$ ruby -pe '$_.sub!(/\R$/,"\n")' file | od -c0000000 w h a t \r i s g o i n g o n \n 0000017
\r
\R
(?>\r\n|\v)
awk
$ awk '{sub(/\r$/,"")} 1' file | od -c0000000 w h a t \r i s g o i n g o n \n 0000017
tr
\r
\r
\r
tr
$ tr -d "\r" < file | od -c0000000 w h a t i s g o i n g o n \n 0000016
sed
sed
\r
\x0D
$ sed 's/\x0D//' file | od -c # also sed 's/\r//'0000000 w h a t \r i s g o i n g o n \n 0000017
TA贡献1825条经验 获得超6个赞
dnf install dos2unix
dos2unix
dos2unix
\r\n
\n
.
tr
\r
tr -d '\r' < infile > outfile
添加回答
举报