Thursday, August 7, 2014

Remove ^M from Windows text files in Unix

If you manipulate with files in ascii format from Windows in Unix environment you will get ^M end of the line character.
To remove it open VI

Type
:%s/(ctrl-v)(ctrl-m)//g
Enter
:x (save and exit)

This will remove ^M, however if you need to substitute ^M with a new line use:
:%s/(ctrl-v)(ctrl-m)/\r/g
Enter
:x (save and exit)

2 comments:

  1. I will be happy if you read my comment. I must say that I like all your posts and wait for new ones. That's because they seem so great and suitable for me. Thanks a ton for uploading your articles.
    Short Ride game racing free || Jump Ball Blast Online games kids for school || online Downhill Rush

    ReplyDelete
  2. What do I say about your posts? I love them. I read them everyday and always wait for new ones. I am very happy because I have something interesting to read. Hope you can upload more and more.
    Santa Snake girls game unblocked || Adam And Eve 5 Part 1 games 2018 || games play free Icy Purple Head

    ReplyDelete