Hi everyone!! I am NOT Topher Grace, nor do I want to be. I am just Topher Scribbles and just for kicks, I really want to out-rank Topher Grace's IMDB website. If you want to help, just link to me. Thanks and enjoy some boring fun!!

Go to http://www.dnsyard.com for some free DNS tools.

Removing ^M from a text file

Do you see ^M at the end of every line? Or ^M at random places where a new line should be?

This seems to happen when a DOS or Windows machine edits a text file. It is the Control Character for Carriage Return. To remove this, you will need to edit the file in Vi. Not sure how to do this in other text editors, but this will definitely work in Vi.

If you want to just remove the ^M characters, run this command in Vi:

s:%/^M//g

NOTE: Do not type Shift-6, Shift-m. That will not work. You will need to hold down ctrl while pressing V then M.If you want to replace each ^M character with a new line, run this command in Vi:

s:%/^M/^M/g

Again, hit ctrl-V-M to issue the second ^M in the replacement field.

Done!!

Post a Comment

You must be logged in to post a comment.