convert file format for dos and unix

by prettyscripts on 2008-01-03 11:55:20 • Leave a comment »

unix

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.

End Of Line

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.

Tags: convert, dos, eol, unix

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
note: all comments are moderated. do not spam and do not advertise. only comments relevant to the post will be published.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)