Sean's i/o Stream

Musings-as-a-Service

Removing silly Windows cruft from perfectly good text files

  • April 01, 2011
  •   category: linux
  • tags: windows, linux, vim

Having Linux be my primary desktop environment is not without it’s challenges working in a large corporation of primarily Windows users, but when this even gets into how I have to treat text files I put my proverbial foot down!

When you see those nasty little ^M characters sneak into your party you can kick them out, a couple quick searches and you will probably find this or a similar global substitution pattern1 that you can use inside Vim or gVim:

:%s/^M//g

Just beware this is a control character so you really need to type:

:%s/{Ctrl+v}{Ctrl+m}//g
Reference:

Removing carriage returns from MS-DOS file

Back to Top