Linux - 刪除文本中的^M

cat filename1 | tr -d “^V^M” > newfile;
or
sed -e “s/^V^M//” filename > outputfilename

需要注意的是在1、2兩種方法中,^V和^M指的是Ctrl+V和Ctrl+M。你必須要手工進行輸入,而不是粘貼。
如果上述方法無用,則正確的解決辦法是:

tr -d "\r" <>dest
tr -d "\015" dest
strings A>B

Comments