in reply to Avoiding printing ^M to STDOUT

Use this regex on the file: s/\r\n$/\n/g I haven't tested it but I think it should work.