I am trying to use hexl mode to manually remove some special chars from a text file and don\'t see how to delete anything in hexl mode.
What I really want is to remove c
No need to find replace. Just use.
M-x delete-trailing-whitespace
You can also set the file encoding through
C-x RET f unix
(in hexl mode) I'm not sure that you can delete characters. I've always converted them to spaces or some other character, switched to the regular text editor, and deleted them there.
Assuming you want a DOS encoded file to be changed into UNIX encoding, use M-x set-buffer-file-coding-system (C-x RET f) to set the coding-system to "unix" and save the file.
You don't need to use hexl-mode. Instead:
The point is that even if you don't how to enter what you are trying to replace, you can always select/copy it.
There's also a command-line tool called unix2dos/dos2unix that exists specifically to convert line endings.
If you want to remove a carriage return (usually displayed as ^M
) and leave the line feed. You can just visit the file w/out any conversion:
M-x find-file-literally /path/to/file
Because a file with carriage returns is generally displayed in DOS mode (hiding the carriage returns). The mode line will likely display (DOS)
on the left side.
Once you've done that, the ^M
will show up and you can delete them like you would any character.