c*t
2 楼
hoho, 除了用 dos2unix 外, 在 emacs 里去掉 ^M 也很容易.
首先到第一行末尾, 在 ^M 前, 打 ^k (Ctrl-k) 将 ^M 吃掉.
然后打 M-x replace-string (enter) 进入 search/replace
mode, 然后打 ^y 把 ^M 给 paste 进去, 再连打两个 (enter)
key 就行了.
在 search/replace mode 里使用 ^y 可以将多行文字, 包括
^M, ^J 等删掉.
首先到第一行末尾, 在 ^M 前, 打 ^k (Ctrl-k) 将 ^M 吃掉.
然后打 M-x replace-string (enter) 进入 search/replace
mode, 然后打 ^y 把 ^M 给 paste 进去, 再连打两个 (enter)
key 就行了.
在 search/replace mode 里使用 ^y 可以将多行文字, 包括
^M, ^J 等删掉.
b*s
3 楼
put following in your .emacs
(global-set-key [f5] 'cut-ctrlM) ; cut all ^M.
;; prevent echoing ^M in the shell (a hard one)
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
;if you encounter a file with ^M or ... at the end of every line,
;this means a worng copy by samba or floppy disk of the DOS file to UNIX.
;get rid of them by pressing [F5]
(defun cut-ctrlM ()
"Cut all visible ^M."
(interactive)
(beginning-of-buffer)
(while (search-forward "\
(global-set-key [f5] 'cut-ctrlM) ; cut all ^M.
;; prevent echoing ^M in the shell (a hard one)
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
;if you encounter a file with ^M or ... at the end of every line,
;this means a worng copy by samba or floppy disk of the DOS file to UNIX.
;get rid of them by pressing [F5]
(defun cut-ctrlM ()
"Cut all visible ^M."
(interactive)
(beginning-of-buffer)
(while (search-forward "\
相关阅读
How to mv files to another directory under ftp> ?which key equals stop+A on hyper terminal? need to go to 'ok' prompt, pls helppermission of the file written by cgi script[转载] Is V.90 modem a WinModem?[转载] Recommend a Book[转载] 谁知道哪儿有 DOS version 的 GNU make?some useful (hopefully) sed command各位大哥,哪儿有免费的INIT: Cannot create /var/adm/utmp or /var/adm/utmpx (help!)Is there any software can D/L a whole directory?大侠帮忙看一下!how to compile wget package???[转载] 大侠救命哪!!!Chinese Font in Netscape[转载] What difference of Mac OS and solaris?any difference between cshell and xterm in Unix?Re: 紧急求助 : I am root user.误删的文件能回复吗?Re: 怎么把Apache设置成proxy serve?how to change environment size in IRIX?