GNU/Linux Command – DOS2UNIX

Creative Commons (CC) is the best and cheapest way to share your art, music or knowledge. URL: http://creativecommons.org/

dos2unix — DOS/MAC to UNIX text file format converter.

Summary:

Each OS will indicate the line end differently using Line Feed (LF,10) or Carriage Return (CR,13). So when tranfering a file from DOS to Unix, you have to convert the Line end from DOS format to Unix format. Otherwise, you will ^M characters in the file. dos2unix will convert the DOS/MAC Text file to Unix format. Unix or Linux uses LF as line end, Windows/DOS uses CR/LF and MacOS uses CR.

Examples:
$ dos2unix dos.txt -- Convert and replace dos.txt. $ dos2unix -n dos.txt gnu.txt -- Convert dos.txt and write into gnu.txt $ dos2unix -k dos.txt -- Convert and replace a.txt while keeping original date stamp.
Read: man dos2unix

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: