Unix dos2unix examples
June 21, 2011 08:32:15 Last update: June 21, 2011 08:32:15
The Dos2unix package includes utilities "dos2unix" and "unix2dos" to convert plain text files in DOS or MAC format to UNIX format and vice versa.
- By default, it replaces the original file:
$ dos2unix base64_encoded.txt dos2unix: converting file base64_encoded.txt to UNIX format ...
- Use the
-nswitch to write the converted output to a new file:$ dos2unix -n base64_encoded.txt unix_formatted.txt dos2unix: converting file base64_encoded.txt to file unix_formatted.txt in UNIX format ...
- Using STDOUT (
-) as output file does not work:$ dos2unix -n base64_encoded.txt -
- Use input redirection to write to STDOUT:
$ dos2unix < base64_encoded.txt