in reply to Removing Control Characters

If you have some files from Macs as well as DOS:
perl -pi.bak -e 's/\r\n?/\n/g' file1 file2
The point being that this will correctly convert both \r\n and \r line endings.