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 "\
相关阅读
[转载] Sendmail的问题?Evolution 1.2.2 on Redhat9.0 can't show Chinese!!is IRIX a brand? or it tellstif 到 ps 文件Unix Computer Security Checklisthard disk for Octane[转载] 谁用过CJK?any command line mms/rtsp file downloader in Unix请问如何在UNIX下面输入特殊字符?[转载] Makefile中-rm的'-'是什么意思?[转载] Help Needed: PowerPC Programming[转载] Regular Express Questioncvg + gprofhow to kill a login?chinese display in mozilla?如何用grep搜索包含ULL且不包含NULL的单词?[转载] 哪里能找到ECOFF的详细规范?[转载] VPN vs. VNC?[转载] gprof question[转载] unix下有没有能同时看GB和BIG5的term?