I have a txt file named COPYING which is edited on windows. It contains windows style eol
$ file COPYING
COPYING: ASCII English text, with CRLF line ter
Emacs won't hide any character by default. Press Ctrl+Meta+%, or Esc then Ctrl+% if the former is too hard on your fingers, or M-x replace-regexp RET
if you prefer. Then, for the regular expression, enter
[^@-^H^K-^_^?]
However, where I wrote ^H
, type Ctrl+Q then Ctrl+H, to enter a “control-H” character literally, and similarly for the others. You can press Ctrl+Q then Ctrl+Space for ^@
, and usually Ctrl+Q then Backspace for ^?
. Replace all occurrences of this regular expression by the empty string.
Since you have the file open in Emacs, you can change its line endings while you're at it. Press C-x RET f
(Ctrl+X Return F) and enter us-ascii-unix
as the new desired encoding for the file.