by prettyscripts on 2008-01-03 11:55:20
most of my development works are done on linux/unix. i use / evaluate a lot of open source projects and some files has ^M when edited from this platform. this is because the file was saved in dos format which uses a different EOL (end of line character).
to overcome this problem, just run this simple unix command:
$ dos2unix <filename>
note that the original file will be overwritten. do a ‘man’ to check options available for this command.
different systems uses different EOL (end of line) characters, which also known as line break or newline.
unix uses ‘\n’. windows uses ‘\n\r’. apple/mac uses ‘\r’.
other EOL conversion commands: unix2dos, mac2unix, unix2mac, mac2dos, dos2mac.