Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
408 views
in Technique[技术] by (71.8m points)

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

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 carriage return and keep linefeed characters. Is Hexl mode the right way to do this?

question from:https://stackoverflow.com/questions/1171609/in-emacs-how-to-strip-cr-m-and-leave-lf-j-characters

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No need for hexl-mode for this. Just do a global-search-and-replace of ^J^M with ^J Works for me. :) Then save the file, kill the buffer, and revisit the file so the window shows the new file mode (Unix vs DOS).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...