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.2008-11-08)

425.   How do I make a FireFox search plugin?   [gregr/2005-05-17]
360.   How can I keep my Alcohol-Laced Yak Beverage cold on a hot, sunny day?   [goodwill/2003-06-02]
352.   Where can I see an example of looping code in G and in C?   [jake/2003-02-26]
322.   how do i verify an address in sendmail?   [jesse/2002-08-30]
290.   what is the maximum temperature for a socket 370 pentium 3?   [jesse/2001-11-27]
284.   whats the best way to encode MP3s on linux?   [jesse/2001-11-13]
277.   What does K-Rad mean? is there a modern alternative to k-rad?   [mennonite/2001-10-08]
267.   Where can I find lava-lamp generated pseudo random numbers?   [rupe/2001-08-16]
262.   Ricochet is dead for now. What are some alternatives?   [rupe/2001-08-07]
216.   Where can I find a copy of the SDMI cracking paper that the RIAA doesn't want published?   [rupe/2001-04-23]
200.   where can i find a good resource for radio repeaters in norther california   [jesse/2001-03-13]
199.   Where can I find pictures of cool PC cases?   [rupe/2001-03-13]
185.   what are some cool domain names?   [jesse/2001-02-26] ( josh/2001-04-03 )
181.   Where does the Yak read?   [rupe/2001-06-05]
178.   Why isn't my PCS email working on my Cingular/PB Wireless phone?   [rupe/2001-02-12]
165.   What's the story with NTSC, PAL, SECAM?   [jss/2001-01-22]
146.   What commands do UNIX system administrators commonly use?   [rupe/2000-11-09] ( strick/2001-01-04 )
116.   where does r0ss come from?   [xenocide/2000-09-10]
108.   How can i get custom ring tones onto my cell phone?   [jesse/2000-07-09]
104.   which pacbell pcs store in the bay area has the best prices and selection?   [jesse/2000-06-18]
89.   What is the connecton between Karl Marx, Cinco de Mayo, and salsa?   [strick/2000-05-05]
72.   What happens when you smoke weed every day for a year and then quit cold turkey.   [vonguard/2000-04-04]
59.   Where are the Yak Research Stickers?   [strick/2000-02-14] ( strick/2000-10-27 )
55.   How can i find out what other websites have links to my website?   [jamison/2000-02-11]
34.   What are some good World Wide Web facts I can impress my friends with?   [simon/2000-01-28]
20.   What is a good tool to beautify HTML? Can it handle the mess generated by many web-page generation programs, especially the bloated files created by Word2000?   [jamison/2000-02-10]