Friday, October 16, 2009

how to remove ^M from a Unix file

^M is DOS line break charater which shows up in unix files when uploaded from a windows file system in ascii format.

Under vi, and enter :s/(ctrl-v)(ctrl-m)//g

Note, we need to press (Ctrl+v) and (Ctrl+m) to get ^M, instead of directly input these two characters. Seems we can also try dos2unix command.

No comments: