[Ilugc] One Day One GNU/Linux Command (DOS2UNIX) ((tag: odoc, linux))

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
  • Date: Thu Sep 17 10:22:59 2009

Creative Commons is the best and cheapest way to share your art, music
or knowledge. There are around 29 internationalized versions of CC.
URL: http://creativecommons.org/worldwide/overview ;

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.

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:
[code]
$ 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.
[/code]
Read: man dos2unix



Other related posts: