![]()
習(xí)慣在windows上瀏覽網(wǎng)頁并保存一些腳本文件,如果通過samba方式傳遞到Ubuntu下,用vi查看編輯此類文件時(shí)候,總會(huì)有^M出現(xiàn)在行尾(如:echo $contents ^M),這是因?yàn)閣indows下的換行符與unix上的不同。
如何快速去掉^M呢,采取以下步驟就行了: 1. vi dosfilename 2. Press Esc 3. Enter this string: %s/^M//g (^M = Ctrl v + Ctrl m) 4. Press enter (the ^M cleared!) 5. :wq! (save the file) :%s/\%u3000//g vim里頭刪除全角空格 %s/^[ \t]*// %s/[ \t]*$//g %s/^ *//g %s/^[0-9]*// %s/“/"/g %s/”/"/g vi -b filename od -c filename vi :%!dxx 看二進(jìn)制文件 |
|