in reply to How to remove "^M" in the files ?

To prevent the problem, transfer in 'ASC' mode, assuming ftp. To fix the files you have, perl -pi -e'tr/\015//d' filename

After Compline,
Zaxo