Posts

Showing posts from November, 2011

How to remove the dreaded '^M' character in unix files

While there are lots of ways to go about solving the issue, two methods that I find to my liking are: 1. Using 'tr' tr -d '^M' < [input filename] > [output filename] e.g; tr -d '^M' < opx_LOD_GEN_110_003110000.ini > test3.txt 2. Using vi editor. :%s/(ctrl-v)(ctrl-m)//g Simply type in the above in your vi editor to get the desired effect. And note that you have to press 'ctrl' AND 'V' and later 'ctrl' AND 'm'. It's not the same as the '^' and 'M' character. Both of them worked for me. Details can be found here: 1) http://www.tech-bits.com/index.php?View=entry&CategoryID=6&EntryID=54 2) http://www.devdaily.com/unix/edu/un010011/