Dos2Unix / Unix2Dos - Text file format converters

Convert text files with DOS or Mac line breaks to Unix line breaks and vice versa.

|dos2unix| unix2dos| contact| http://waterlan.home.xs4all.nl/|

History

This is an update of Benjamin Lin's implementations of dos2unix and unix2dos. Benjamin Lin's implementations of dos2unix and unix2dos were distributed via SunSITE.unc.edu (later MetaLab.unc.edu, now ibiblio) and became part of several Linux distributions such as RedHat, Suse, Gentoo, and others. This update includes all RedHat patches and fixes several other problems. Internationalization has been added and ports to DOS, Windows, Cygwin and OS/2 Warp have been made.

These implementations of dos2unix and unix2dos have been modelled after dos2unix/unix2dos under SunOS/Solaris. The first versions were made by John Birchfield in 1989, and in 1995 rewritten from scratch by Benjamin Lin. Mac to Unix conversion was added by Bernd Johannes Wuebben in 1998, Unix to Mac conversion by Erwin Waterlander in 2010.

In 2010 the two separate dos2unix and unix2dos packages have been bundled into a single dos2unix package (version 5.0). Support for Unicode UTF-16 was added in 2012 (version 6.0).

Features

Latest version: 7.1.1-beta5 (2014-12-08)

Stable version: 7.1 (2014-10-06)

News

2014-12-08: Version 7.1.1-beta5. When the input file is UTF-16, the input and output formats are printed.
2014-12-08: Version 7.1.1-beta4. On Unix/Linux convert UTF-16 to the locale encoding. It is no longer required that the locale encoding is UTF-8. When conversion is not possible an error will occur and conversion will be skipped.
2014-12-06: Version 7.1.1-beta3. Support conversion of UTF-16 to GB18030.
2014-11-09: Version 7.1.1-beta1. New Japanese translation of the UI messages.
2014-10-06: Version 7.1. New option -i, --info, display file information. This new option prints number of line breaks (DOS Unix Mac), the byte order mark, and if the file is text or binary. It can also print the names of files that would be converted.
2014-09-09: Version 7.0. New option -u: Keep UTF-16 encoding of input file. New option -v: Verbose. Print extra information about amount of converted line breaks and BOMs. New self-tests. Stdio mode does not automatically set quiet option and does not automatically force conversion of binaries. Code cleanup.
2014-08-03: Version 6.0.6. Bug fix: mac2unix conversion produced corrupted output from UTF-16 input file. New options -b (keep BOM) and -r (remove BOM). New translation of the UI messages: Norwegian Bokmaal.
2014-04-17: Version 6.0.5. New translations of the UI messages: Brazilian Portuguese, Chinese (traditional), Danish, French, Hungarian, Polish, Serbian, Ukrainian, Vietnamese. New translations of the manual: Brazilian Portuguese, French, German, Polish, Ukrainian. Windows version skips by default symbolic links.
2013-12-30: Version 6.0.4. Build Windows 32 bit version with Large File Support (LFS), this fixes problems with (huge) files on network shares. New Russian translation of messages. New options -ul and -ub to convert UTF-16 files without BOM. Print value of binary symbol when found.
2013-01-25: Version 6.0.3. Dos2unix compiles with Microsoft Visual C++. Print system error when writing to output fails.
2012-12-11: Dos2unix moved to a new subversion repo. See below.
2012-09-06: Version 6.0.2. The locale encoding detection has been fixed when NLS was disabled. Print line number when a binary symbol is found. Updated makefiles for Watcom C, and added a new one for OS/2.
2012-07-25: Version 6.0.1. The Spanish translations and the manual have been updated.
2012-05-06: Version 6.0. Conversion of Windows UTF-16 files to Unix UTF-8 files. Conversion of Unix UTF-8 files to Windows UTF-8 files with byte order mark.
2012-03-10: Version 5.3.3. Enabled wildcard expansion for all versions. Fixed a compile error when compiled with debug enabled.
2012-01-27: Version 5.3.2. Native MSYS version. Wildcard support on OS/2. Compiles with OpenWatcom for dos32 and win32.
2011-08-09: Version 5.3.1. Spanish translation of messages and manual. File ownership is maintained in old file mode (Unix only). Source code cleanup.
2011-04-26: Version 5.3. Improved handling of symbolic links. Improved error handling. Improvements for Cygwin.
2011-03-04: Version 5.2.1. Improved error messages. Enable Large File Support. PDF manual generation is optional.
2011-01-31: Version 5.2. ISO mode supports same code pages as SunOS dos2unix (CP437/850/860/863/865) and CP1252. Removed generated documentation files from source package. 7bit and Iso mode can be used in Mac mode. Form Feed is treated as legal text character.
2010-08-18: Version 5.1.1. Dutch manual. Fixes compilation on Darwin OS. Win64 port.
2010-04-03: Version 5.1: Esperanto translation. Merged man pages. Port to 16 bit DOS. Allow to set options in stdio mode. Bugfix dos2unix MAC mode: don't change DOS line endings.
2010-02-16: Version 5.0. Dos2unix and Unix2dos have been bundled in a single package. German translations have been added. Dos2unix -l --newline also works in MAC mode. Unix2dos also got option -l, --newline. Added MAC mode to Unix2dos: Convert Unix line endings to Mac line endings. Cleanup of messages and manual.
2010-01-24: Version 4.1.2 preserves file modes in new file mode.
2010-01-21: Version 4.1.1 fixes a compilation problem on FreeBSD.
2009-12-28: Version 4.1 automatically skips binary and non-regular files, and the ISO mode has been cleaned up (see ChangeLog).
2009-12-21: Version 4.0.1 adds a port to OS/2 Warp. Two wrong conversions in ISO mode have been fixed. The manual page has been updated.
2009-12-15: Version 4.0 adds internationalisation (Native Language Support, NLS). A Dutch translation has been added. Ports to Windows and DOS have been made. The problem in DOS/Windows stdio mode has been fixed. The manual has been updated.

Dos2Unix - text file format converters

includes:
dos2unix - DOS/Mac to Unix text file format converter (dos2unix/mac2unix)
unix2dos - Unix to DOS/Mac text file format converter (unix2dos/unix2mac)

Wanted: translators.
If you want to help translating the dos2unix messages into more languages go to the Translation Project.
Translation of UI messages here
Translation of manual here

NEWS.txt Basic change log.
ChangeLog Detailed change log.

Dos2Unix manual
Dutch
English
French
German
Polish
Portuguese (Brazilian)
Spanish
Ukrainian

COPYING.txt Distribution license, FreeBSD (GPL compatible)
TODO.txt Things to do.
BUGS.txt Known bugs and instructions on reporting new ones.
README.txt General information.
INSTALL.txt Instructions how to build dos2unix yourself.
DONATE If you want to give something back.

Source code
dos2unix-7.1.tar.gz Source code, Unix text.
d2u71.zip Source code, DOS text. Including doc files.

Binaries, English only.
d2u71b.zip DOS 16 bit version.
d2u71pm.zip DOS 32 bit protected mode version.
dos2unix-7.1-win32.zip Windows 32 bit version.
dos2unix-7.1-win64.zip Windows 64 bit version.
dos2unix-7.1-os2-watcom.zip OS/2 Warp version. (Thanks to Elbert Pol)

Binaries with Native Language Support (NLS)
d2u71pm-nls.zip DOS 32 bit protected mode version.
dos2unix-7.1-win32-nls.zip Windows 32 bit version.
dos2unix-7.1-win64-nls.zip Windows 64 bit version.

Old versions.

Latest version

dos2unix-7.1.1-beta5.tar.gz Source code (Unix text)
d2u711b5.zip Source code (DOS text).
dos2unix-7.1.1-beta5-win32.zip Windows 32 bit version.
dos2unix-7.1.1-beta5-win64.zip Windows 64 bit version.
dos2unix-7.1.1-beta5-win32-nls.zip Windows 32 bit version. With Native Language Support.
dos2unix-7.1.1-beta5-win64-nls.zip Windows 64 bit version. With Native Language Support.

Recursive conversion of files

To recursively convert text files in a directory tree, use dos2unix in combination with the 'find' and 'xargs' commands. For instance to convert all .txt files under the current directory type:

find . -name *.txt |xargs dos2unix

Windows users can get find and xargs from the findutils package for Windows from the ezwinports project at http://sourceforge.net/projects/ezwinports/files/.

Manual pages SunOS versions

SunOS dos2unix man page
SunOS unix2dos man page

Distributions including this version of dos2unix

openSUSE see here.
Fedora Linux, here (rpmfind.net) or "sudo yum install dos2unix"
Mandriva Linux. mandriva.com. Search via rpmfind.net
Arch Linux package, look here.
Slackware package here.
Gentoo Linux provides Dos2unix in its package repository. See here
Debian Linux. See here.
Ubuntu Linux (universe). See here. "sudo apt-get install dos2unix"
Linux Mint. See here.
Fink project, Darwin and Mac OS X. See here.
MacPorts portfile. See here.
HomeBrew. See here.
Sunfreeware, Freeware for Solaris. See http://www.sunfreeware.com.
NetBSD Packages Collection. See converters/dos2unix.
Cygwin. See http://cygwin.com/. Install with Cygwins' setup.exe. Utils/dos2unix.
MSYS/MinGW. See http://www.mingw.org/. Install with "mingw-get install msys-dos2unix" or "mingw-get install mingw32-dos2unix"
FreeDOS. See http://www.freedos.org/. See here for the files in the FreeDOS distribution.

Source code libintl DLL

The win32 binaries are packaged with with a patched version of MinGW's libintl DLL that has builtin relocation support. See http://waterlan.home.xs4all.nl/libintl.html

Unix2Dos - Unix to DOS text file format converter

Since version 5.0 (2010-02-16) is Unix2Dos included in the Dos2Unix package. The separate Unix2Dos package is now obsolete.

Old versions.

Development

SourceForge project page : http://sourceforge.net/projects/dos2unix/

Latest development version from Subversion repository:

Dos2unix moved to a new subversion repository on Dec 11 2012. Check out the new repo with this command:

svn checkout svn://svn.code.sf.net/p/dos2unix/code/trunk dos2unix-code

Alternative implementations

Tofrodos by Christopher Heng
hd2u: Hany's Dos2Unix by Peter Hanecak
CygUtils contains "conv", a heavily modified version of hd2u.
Dos2Unix/Unix2Dos by Clem Dye
Flip by Craig Stuart Sapp
Flip by Rahul Dhesi.
Flip by James R. van Zandt/Rahul Dhesi.
TRCH by James Hall (FreeDos)
Unix2Dos by Angelo Campagnari
dtou/utod Part of DJGPP's development kit.
d2u by Purple Sage Computing Solutions, Inc.
strp by Eddie Buckley
u2d by Liam C. Drew
xchange by Amin Hamdan
dos2unix by Alain. Written in Delphi 3.
dos2unix/unix2dos by BestCode. Part of File Utilities tool set (commercial)
Endlines by Mathias Dolidon

Contact

Erwin Waterlander