by macki

How do you get rid of the ^M characters that are visible when a microsoft text file is edited in UNIX?

in vi type:
:%s/<ctrl-v><ctrl-M>//g

hitting control-v lets it know that the next character entered is a control character, so when you hit control-M it gets displayed as ^M, but it's literally control-M.

it should appear as:
:%s/^M//g

:x to exit and save for you non-vi types. :q! to exit and not save if you screw up.

 


 
Read more of   The Yak's Frequently Questioned Answers   (mod.2010-02-10)

440.   What are rainbow tables?   [aestetix/2006-10-06]
433.   My boss has developers that use SOAP? How can I help them debug their lame web2.0 non-sense? (Or how can i search inside a given http session for a string using tethereal?)   [jake/2006-05-24]
376.   What are three very useful online dictionaries?   [jake/2003-09-22]
290.   what is the maximum temperature for a socket 370 pentium 3?   [jesse/2001-11-27]
254.   how do i setup my orinoco wirelss card with linux 2.4.x?   [jesse/2001-07-03]
230.   What is a good book to get started with Python?   [rupe/2001-05-30]
217.   Why must I use NiMH (nickel metal hydride) batteries?   [strick/2001-05-09]
138.   How can I become an asshole in five easy steps?   [chota/2000-10-22]
137.   where can i find docs for radioshack scanners?   [jesse/2000-10-20]
128.   What is a TINI, and what are some good sources of information on it?   [jesse/2000-10-07]
116.   where does r0ss come from?   [xenocide/2000-09-10]
100.   What is WAX?   [rupe/2000-06-10]
72.   What happens when you smoke weed every day for a year and then quit cold turkey.   [vonguard/2000-04-04]
51.   I'm playing with dialpad.com -- What's the USGS earthquake info phone #?   [strick/2000-02-06]
50.   If the mass number of an isotope is much greater than twice the atomic number, what type of radioactive decay might you expect?   [kurt/2000-02-06]
46.   What is Ross' natural hair color?   [macki/2000-02-03]
42.   What is there worth seeing in the city of Louisville, Kentucky?   [chota/2001-05-26]
9.   Where is matt.html's home page?   [strick/2000-01-18]