天天看點

linux ^m符号,Linux下清除^M符号的方法

在Linux下,^M符号代表着/n/r回車符,這是windows下的回車符,而Linux下的回車符是/n,是以在windows下編寫的文檔,如果沒有使用特殊編輯器編輯過的話,會顯示出^M符号并且會影響到文檔的運作。

在vi編輯器中,使用以下方法可以一鍵清除文檔内所有^M符号。

使用vi打開文檔,在沒有使用i進入編輯模式的時候,就按下鍵盤上的SHIFT鍵+:(半角字元的冒号),進入vi指令行模式,輸入以下内容并回車就可以一鍵清除^M符号。

%s/\r//

連接配接起來是這樣的

:%s/\r//

然後按下鍵盤上的SHIFT鍵+ZZ鍵(2個Z)就可以儲存文檔。

linux ^m符号,Linux下清除^M符号的方法
linux ^m符号,Linux下清除^M符号的方法

sicnature ---------------------------------------------------------------------

Your current IP address is: 60.31.89.242

Your IP address location: 内蒙古烏海市聯通

Your IP address country and region: 中國

linux ^m符号,Linux下清除^M符号的方法

Your current browser is:

linux ^m符号,Linux下清除^M符号的方法

Your current system is:

linux ^m符号,Linux下清除^M符号的方法

Original content, please indicate the source:

同福客棧論壇 | 蟒蛇科普 | 海南鄉情論壇 | JiaYu Blog

sicnature ---------------------------------------------------------------------

Welcome to reprint. Please indicate the source https://www.myzhenai.com.cn/post/3760.html