This would be annoying when it comes to the unix world.
Two easy ways to remove this -
1. dos2unix command
2. Vim search & replace
:%s/^V^M//g [ type Ctrl-V Ctrl-M]
this will translate to
:%s/^M//g [ remember Ctrl-V is escape sequence in Unix]
