Because I regularly move between operating systems, I often need to use Windows-created files on Linux. Because of the difference in EOL notation between the operating systems (notice how I carefully avoided any editorial comment on that difference?), that means regularly encountering the ^M character.
While I’ve never found a situation where the character creates a real problem for me, it’s certainly annoying to see those things all over a large file. In the past I’ve used elbow grease and/or various shell scripts to clear these, but today I found out that Ubuntu (probably other distros, as well) offers a utility to do this quickly and easily.
The package is named tofrodos and, while not installed by default, is available in the repository. To install & use:
$ sudo apt-get install tofrodos $ dos2unix <file to convert>
Couldn’t be easier, right? This is the thing I love best about Linux.