[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: removing ^M from a text file



On Tue, 12 Jan 1999, M.C. Vernon wrote:

> Dear all,
> 
> 	I had the misfortune to be stuck with MSWrite over the vac, and
> although I told it to save as plain text, it didn't. I can delete most of
> the cruft, but there is ^M at the end of each and every line. I've tried
> catdoc, word2x, and sed, but none of them will remove them. Can you
> suggest anything, please? 
> 
> Thanks,
> Matthew

Hi Matthew

In emacs, you can use the search and replace function:

	M-% C-Q C-M <ret><ret>!

This cryptic bit says: 

	M-%  search and replace
	C-q C-M Control q allows entry of literal control M
	<ret> terminates search string
	<ret> make replacement string empty
	!     make all replacements

(Just as ugly as the vi response I saw.  <grin>)

There are also utilities that will do this. I'm sorry I don't
have them at hand. 

--Good Luck,
David Teague dbt@elentari.cs.wcu.edu
Debian GNU/Linux: Becuase operating systems should not be expected to
		  crash.






Reply to: