Unix2dos
   HOME

TheInfoList



OR:

(sometimes named or ) is a tool to convert line breaks in a
text file A text file (sometimes spelled textfile; an old alternative name is flatfile) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system. In operating ...
from
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
format (Line feed) to
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
format (
carriage return A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed a ...
+ Line feed) and vice versa. When invoked as the program will convert a Unix text file to DOS format, when invoked as it will convert a DOS text file to UNIX format. A practical guide to Linux. Mark G. Sobell Page 55


Usage

Unix2dos and dos2unix are not part of the Unix standard. Commercial Unixes usually come with their own implementation of unix2dos/dos2unix, like SunOS/Solaris's ''dos2unix/unix2dos'', HP-UX's ''dos2ux/ux2dos'' and Irix's ''to_unix/to_dos''. There exist many open source alternatives with different command names and options like ''dos2unix/unix2dos'', ''d2u/u2d'', ', ''endlines'', ''flip''. See the
manual page A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and ev ...
of the respective commands.


Alternatives to unix2dos conversion


Alternatives to dos2unix conversion

For the opposite conversion () it is possible to use, for example, the utility tr with the flag to remove the carriage return characters: * $ tr -d '\r' < file > file2 # For ASCII and other files which do not contain multibyte characters (Not utf-8 safe). * $ perl -i -p -e 's/\r//g' file * $ sed -i -e 's/\r//g' file Note: The above method assumes there are only DOS line breaks in the input file. Any Mac line breaks (\r) present in the input will be removed. An alternative to the dos2unix conversion is possible by using the command that is available on
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
and other Unix-like operating systems, including Mac OS X. In the following case, InFile contains the undesired DOS (^M) line endings. After execution, OutFile is either created or replaced, and contains UNIX line endings. The option tells not to output backspace characters. $ col -b < InFile > OutFile


See also

*
Newline Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a ...


References


External links


Tofrodos
- software that provides dos2unix and unix2dos

- Dos2Unix / Unix2Dos - Text file format converters System administration Unix text processing utilities {{unix-stub