In emacs, how to strip CR (^M) and leave LF (^J) characters?

前端 未结 10 561
感动是毒
感动是毒 2021-01-31 03:01

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

10条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 03:28

    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.

提交回复
热议问题