3 回答

慕斯709654
TA貢獻(xiàn)1840條經(jīng)驗(yàn) 獲得超5個(gè)贊
"\r"
, 0x0d
$ cat infile hello goodbye $ cat infile | od -c 0000000 h e l l o \r \n g o o d b y e \n 0000017
dos2unix
$ cat infile | dos2unix -U | od -c 0000000 h e l l o \n g o o d b y e \n 0000016
dos2unix
sed
$ cat infile | sed 's/\r$//' | od -c 0000000 h e l l o \n g o o d b y e \n 0000016
sed
ed
$ echo ',s/\r\n/\n/ > w !cat > Q' | ed infile 2>/dev/null | od -c 0000000 h e l l o \n g o o d b y e \n 0000016

繁星coding
TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊
tr -d '\r' < filewithcarriagereturns > filewithoutcarriagereturns
添加回答
舉報(bào)
0/150
提交
取消