"Fossies" - the Fresh Open Source Software Archive

Member "share/doc/dos2unix-7.4.2/dos2unix.txt" (12 Oct 2020, 29226 Bytes) of package /windows/misc/dos2unix-7.4.2-win64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ´╗┐NAME
    2     dos2unix - DOS/Mac to Unix and vice versa text file format converter
    3 
    4 SYNOPSIS
    5         dos2unix [options] [FILE ...] [-n INFILE OUTFILE ...]
    6         unix2dos [options] [FILE ...] [-n INFILE OUTFILE ...]
    7 
    8 DESCRIPTION
    9     The Dos2unix package includes utilities "dos2unix" and "unix2dos" to
   10     convert plain text files in DOS or Mac format to Unix format and vice
   11     versa.
   12 
   13     In DOS/Windows text files a line break, also known as newline, is a
   14     combination of two characters: a Carriage Return (CR) followed by a Line
   15     Feed (LF). In Unix text files a line break is a single character: the
   16     Line Feed (LF). In Mac text files, prior to Mac OS X, a line break was
   17     single Carriage Return (CR) character. Nowadays Mac OS uses Unix style
   18     (LF) line breaks.
   19 
   20     Besides line breaks Dos2unix can also convert the encoding of files. A
   21     few DOS code pages can be converted to Unix Latin-1. And Windows Unicode
   22     (UTF-16) files can be converted to Unix Unicode (UTF-8) files.
   23 
   24     Binary files are automatically skipped, unless conversion is forced.
   25 
   26     Non-regular files, such as directories and FIFOs, are automatically
   27     skipped.
   28 
   29     Symbolic links and their targets are by default kept untouched. Symbolic
   30     links can optionally be replaced, or the output can be written to the
   31     symbolic link target. Writing to a symbolic link target is not supported
   32     on Windows.
   33 
   34     Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
   35     important difference with the original SunOS/Solaris version. This
   36     version does by default in-place conversion (old file mode), while the
   37     original SunOS/Solaris version only supports paired conversion (new file
   38     mode). See also options "-o" and "-n". Another difference is that the
   39     SunOS/Solaris version uses by default *iso* mode conversion while this
   40     version uses by default *ascii* mode conversion.
   41 
   42 OPTIONS
   43     --  Treat all following options as file names. Use this option if you
   44         want to convert files whose names start with a dash. For instance to
   45         convert a file named "-foo", you can use this command:
   46 
   47             dos2unix -- -foo
   48 
   49         Or in new file mode:
   50 
   51             dos2unix -n -- -foo out.txt
   52 
   53     --allow-chown
   54         Allow file ownership change in old file mode.
   55 
   56         When this option is used, the conversion will not be aborted when
   57         the user and/or group ownership of the original file can't be
   58         preserved in old file mode. Conversion will continue and the
   59         converted file will get the same new ownership as if it was
   60         converted in new file mode. See also options "-o" and "-n". This
   61         option is only available if dos2unix has support for preserving the
   62         user and group ownership of files.
   63 
   64     -ascii
   65         Convert only line breaks. This is the default conversion mode.
   66 
   67     -iso
   68         Conversion between DOS and ISO-8859-1 character set. See also
   69         section CONVERSION MODES.
   70 
   71     -1252
   72         Use Windows code page 1252 (Western European).
   73 
   74     -437
   75         Use DOS code page 437 (US). This is the default code page used for
   76         ISO conversion.
   77 
   78     -850
   79         Use DOS code page 850 (Western European).
   80 
   81     -860
   82         Use DOS code page 860 (Portuguese).
   83 
   84     -863
   85         Use DOS code page 863 (French Canadian).
   86 
   87     -865
   88         Use DOS code page 865 (Nordic).
   89 
   90     -7  Convert 8 bit characters to 7 bit space.
   91 
   92     -b, --keep-bom
   93         Keep Byte Order Mark (BOM). When the input file has a BOM, write a
   94         BOM in the output file. This is the default behavior when converting
   95         to DOS line breaks. See also option "-r".
   96 
   97     -c, --convmode CONVMODE
   98         Set conversion mode. Where CONVMODE is one of: *ascii*, *7bit*,
   99         *iso*, *mac* with ascii being the default.
  100 
  101     -D, --display-enc ENCODING
  102         Set encoding of displayed text. Where ENCODING is one of: *ansi*,
  103         *unicode*, *unicodebom*, *utf8*, *utf8bom* with ansi being the
  104         default.
  105 
  106         This option is only available in dos2unix for Windows with Unicode
  107         file name support. This option has no effect on the actual file
  108         names read and written, only on how they are displayed.
  109 
  110         There are several methods for displaying text in a Windows console
  111         based on the encoding of the text. They all have their own
  112         advantages and disadvantages.
  113 
  114         ansi
  115             Dos2unix's default method is to use ANSI encoded text. The
  116             advantage is that it is backwards compatible. It works with
  117             raster and TrueType fonts. In some regions you may need to
  118             change the active DOS OEM code page to the Windows system ANSI
  119             code page using the "chcp" command, because dos2unix uses the
  120             Windows system code page.
  121 
  122             The disadvantage of ansi is that international file names with
  123             characters not inside the system default code page are not
  124             displayed properly. You will see a question mark, or a wrong
  125             symbol instead. When you don't work with foreign file names this
  126             method is OK.
  127 
  128         unicode, unicodebom
  129             The advantage of unicode (the Windows name for UTF-16) encoding
  130             is that text is usually properly displayed. There is no need to
  131             change the active code page. You may need to set the console's
  132             font to a TrueType font to have international characters
  133             displayed properly. When a character is not included in the
  134             TrueType font you usually see a small square, sometimes with a
  135             question mark in it.
  136 
  137             When you use the ConEmu console all text is displayed properly,
  138             because ConEmu automatically selects a good font.
  139 
  140             The disadvantage of unicode is that it is not compatible with
  141             ASCII. The output is not easy to handle when you redirect it to
  142             another program.
  143 
  144             When method "unicodebom" is used the Unicode text will be
  145             preceded with a BOM (Byte Order Mark). A BOM is required for
  146             correct redirection or piping in PowerShell.
  147 
  148         utf8, utf8bom
  149             The advantage of utf8 is that it is compatible with ASCII. You
  150             need to set the console's font to a TrueType font. With a
  151             TrueType font the text is displayed similar as with the
  152             "unicode" encoding.
  153 
  154             The disadvantage is that when you use the default raster font
  155             all non-ASCII characters are displayed wrong. Not only unicode
  156             file names, but also translated messages become unreadable. On
  157             Windows configured for an East-Asian region you may see a lot of
  158             flickering of the console when the messages are displayed.
  159 
  160             In a ConEmu console the utf8 encoding method works well.
  161 
  162             When method "utf8bom" is used the UTF-8 text will be preceded
  163             with a BOM (Byte Order Mark). A BOM is required for correct
  164             redirection or piping in PowerShell.
  165 
  166         The default encoding can be changed with environment variable
  167         DOS2UNIX_DISPLAY_ENC by setting it to "unicode", "unicodebom",
  168         "utf8", or "utf8bom".
  169 
  170     -f, --force
  171         Force conversion of binary files.
  172 
  173     -gb, --gb18030
  174         On Windows UTF-16 files are by default converted to UTF-8,
  175         regardless of the locale setting. Use this option to convert UTF-16
  176         files to GB18030. This option is only available on Windows. See also
  177         section GB18030.
  178 
  179     -h, --help
  180         Display help and exit.
  181 
  182     -i[FLAGS], --info[=FLAGS] FILE ...
  183         Display file information. No conversion is done.
  184 
  185         The following information is printed, in this order: number of DOS
  186         line breaks, number of Unix line breaks, number of Mac line breaks,
  187         byte order mark, text or binary, file name.
  188 
  189         Example output:
  190 
  191              6       0       0  no_bom    text    dos.txt
  192              0       6       0  no_bom    text    unix.txt
  193              0       0       6  no_bom    text    mac.txt
  194              6       6       6  no_bom    text    mixed.txt
  195             50       0       0  UTF-16LE  text    utf16le.txt
  196              0      50       0  no_bom    text    utf8unix.txt
  197             50       0       0  UTF-8     text    utf8dos.txt
  198              2     418     219  no_bom    binary  dos2unix.exe
  199 
  200         Note that sometimes a binary file can be mistaken for a text file.
  201         See also option "-s".
  202 
  203         Optionally extra flags can be set to change the output. One or more
  204         flags can be added.
  205 
  206         0   Print the file information lines followed by a null character
  207             instead of a newline character. This enables correct
  208             interpretation of file names with spaces or quotes when flag c
  209             is used. Use this flag in combination with xargs(1) option -0 or
  210             "--null".
  211 
  212         d   Print number of DOS line breaks.
  213 
  214         u   Print number of Unix line breaks.
  215 
  216         m   Print number of Mac line breaks.
  217 
  218         b   Print the byte order mark.
  219 
  220         t   Print if file is text or binary.
  221 
  222         c   Print only the files that would be converted.
  223 
  224             With the "c" flag dos2unix will print only the files that
  225             contain DOS line breaks, unix2dos will print only file names
  226             that have Unix line breaks.
  227 
  228         h   Print a header.
  229 
  230         p   Show file names without path.
  231 
  232         Examples:
  233 
  234         Show information for all *.txt files:
  235 
  236             dos2unix -i *.txt
  237 
  238         Show only the number of DOS line breaks and Unix line breaks:
  239 
  240             dos2unix -idu *.txt
  241 
  242         Show only the byte order mark:
  243 
  244             dos2unix --info=b *.txt
  245 
  246         List the files that have DOS line breaks:
  247 
  248             dos2unix -ic *.txt
  249 
  250         List the files that have Unix line breaks:
  251 
  252             unix2dos -ic *.txt
  253 
  254         Convert only files that have DOS line breaks and leave the other
  255         files untouched:
  256 
  257             dos2unix -ic0 *.txt | xargs -0 dos2unix
  258 
  259         Find text files that have DOS line breaks:
  260 
  261             find -name '*.txt' -print0 | xargs -0 dos2unix -ic
  262 
  263     -k, --keepdate
  264         Keep the date stamp of output file same as input file.
  265 
  266     -L, --license
  267         Display program's license.
  268 
  269     -l, --newline
  270         Add additional newline.
  271 
  272         dos2unix: Only DOS line breaks are changed to two Unix line breaks.
  273         In Mac mode only Mac line breaks are changed to two Unix line
  274         breaks.
  275 
  276         unix2dos: Only Unix line breaks are changed to two DOS line breaks.
  277         In Mac mode Unix line breaks are changed to two Mac line breaks.
  278 
  279     -m, --add-bom
  280         Write a Byte Order Mark (BOM) in the output file. By default an
  281         UTF-8 BOM is written.
  282 
  283         When the input file is UTF-16, and the option "-u" is used, an
  284         UTF-16 BOM will be written.
  285 
  286         Never use this option when the output encoding is other than UTF-8,
  287         UTF-16, or GB18030. See also section UNICODE.
  288 
  289     -n, --newfile INFILE OUTFILE ...
  290         New file mode. Convert file INFILE and write output to file OUTFILE.
  291         File names must be given in pairs and wildcard names should *not* be
  292         used or you *will* lose your files.
  293 
  294         The person who starts the conversion in new file (paired) mode will
  295         be the owner of the converted file. The read/write permissions of
  296         the new file will be the permissions of the original file minus the
  297         umask(1) of the person who runs the conversion.
  298 
  299     --no-allow-chown
  300         Don't allow file ownership change in old file mode (default).
  301 
  302         Abort conversion when the user and/or group ownership of the
  303         original file can't be preserved in old file mode. See also options
  304         "-o" and "-n". This option is only available if dos2unix has support
  305         for preserving the user and group ownership of files.
  306 
  307     -o, --oldfile FILE ...
  308         Old file mode. Convert file FILE and overwrite output to it. The
  309         program defaults to run in this mode. Wildcard names may be used.
  310 
  311         In old file (in-place) mode the converted file gets the same owner,
  312         group, and read/write permissions as the original file. Also when
  313         the file is converted by another user who has write permissions on
  314         the file (e.g. user root). The conversion will be aborted when it is
  315         not possible to preserve the original values. Change of owner could
  316         mean that the original owner is not able to read the file any more.
  317         Change of group could be a security risk, the file could be made
  318         readable for persons for whom it is not intended. Preservation of
  319         owner, group, and read/write permissions is only supported on Unix.
  320 
  321         To check if dos2unix has support for preserving the user and group
  322         ownership of files type "dos2unix -V".
  323 
  324         Conversion is always done via a temporary file. When an error occurs
  325         halfway the conversion, the temporary file is deleted and the
  326         original file stays intact. When the conversion is successful, the
  327         original file is replaced with the temporary file. You may have
  328         write permission on the original file, but no permission to put the
  329         same user and/or group ownership properties on the temporary file as
  330         the original file has. This means you are not able to preserve the
  331         user and/or group ownership of the original file. In this case you
  332         can use option "--allow-chown" to continue with the conversion:
  333 
  334             dos2unix --allow-chown foo.txt
  335 
  336         Another option is to use new file mode:
  337 
  338             dos2unix -n foo.txt foo.txt
  339 
  340         The advantage of the "--allow-chown" option is that you can use
  341         wildcards, and the ownership properties will be preserved when
  342         possible.
  343 
  344     -q, --quiet
  345         Quiet mode. Suppress all warnings and messages. The return value is
  346         zero. Except when wrong command-line options are used.
  347 
  348     -r, --remove-bom
  349         Remove Byte Order Mark (BOM). Do not write a BOM in the output file.
  350         This is the default behavior when converting to Unix line breaks.
  351         See also option "-b".
  352 
  353     -s, --safe
  354         Skip binary files (default).
  355 
  356         The skipping of binary files is done to avoid accidental mistakes.
  357         Be aware that the detection of binary files is not 100% foolproof.
  358         Input files are scanned for binary symbols which are typically not
  359         found in text files. It is possible that a binary file contains only
  360         normal text characters. Such a binary file will mistakenly be seen
  361         as a text file.
  362 
  363     -u, --keep-utf16
  364         Keep the original UTF-16 encoding of the input file. The output file
  365         will be written in the same UTF-16 encoding, little or big endian,
  366         as the input file. This prevents transformation to UTF-8. An UTF-16
  367         BOM will be written accordingly. This option can be disabled with
  368         the "-ascii" option.
  369 
  370     -ul, --assume-utf16le
  371         Assume that the input file format is UTF-16LE.
  372 
  373         When there is a Byte Order Mark in the input file the BOM has
  374         priority over this option.
  375 
  376         When you made a wrong assumption (the input file was not in UTF-16LE
  377         format) and the conversion succeeded, you will get an UTF-8 output
  378         file with wrong text. You can undo the wrong conversion with
  379         iconv(1) by converting the UTF-8 output file back to UTF-16LE. This
  380         will bring back the original file.
  381 
  382         The assumption of UTF-16LE works as a *conversion mode*. By
  383         switching to the default *ascii* mode the UTF-16LE assumption is
  384         turned off.
  385 
  386     -ub, --assume-utf16be
  387         Assume that the input file format is UTF-16BE.
  388 
  389         This option works the same as option "-ul".
  390 
  391     -v, --verbose
  392         Display verbose messages. Extra information is displayed about Byte
  393         Order Marks and the amount of converted line breaks.
  394 
  395     -F, --follow-symlink
  396         Follow symbolic links and convert the targets.
  397 
  398     -R, --replace-symlink
  399         Replace symbolic links with converted files (original target files
  400         remain unchanged).
  401 
  402     -S, --skip-symlink
  403         Keep symbolic links and targets unchanged (default).
  404 
  405     -V, --version
  406         Display version information and exit.
  407 
  408 MAC MODE
  409     In normal mode line breaks are converted from DOS to Unix and vice
  410     versa. Mac line breaks are not converted.
  411 
  412     In Mac mode line breaks are converted from Mac to Unix and vice versa.
  413     DOS line breaks are not changed.
  414 
  415     To run in Mac mode use the command-line option "-c mac" or use the
  416     commands "mac2unix" or "unix2mac".
  417 
  418 CONVERSION MODES
  419     ascii
  420         In mode "ascii" only line breaks are converted. This is the default
  421         conversion mode.
  422 
  423         Although the name of this mode is ASCII, which is a 7 bit standard,
  424         the actual mode is 8 bit. Use always this mode when converting
  425         Unicode UTF-8 files.
  426 
  427     7bit
  428         In this mode all 8 bit non-ASCII characters (with values from 128 to
  429         255) are converted to a 7 bit space.
  430 
  431     iso Characters are converted between a DOS character set (code page) and
  432         ISO character set ISO-8859-1 (Latin-1) on Unix. DOS characters
  433         without ISO-8859-1 equivalent, for which conversion is not possible,
  434         are converted to a dot. The same counts for ISO-8859-1 characters
  435         without DOS counterpart.
  436 
  437         When only option "-iso" is used dos2unix will try to determine the
  438         active code page. When this is not possible dos2unix will use
  439         default code page CP437, which is mainly used in the USA. To force a
  440         specific code page use options -437 (US), -850 (Western European),
  441         -860 (Portuguese), -863 (French Canadian), or -865 (Nordic). Windows
  442         code page CP1252 (Western European) is also supported with option
  443         -1252. For other code pages use dos2unix in combination with
  444         iconv(1). Iconv can convert between a long list of character
  445         encodings.
  446 
  447         Never use ISO conversion on Unicode text files. It will corrupt
  448         UTF-8 encoded files.
  449 
  450         Some examples:
  451 
  452         Convert from DOS default code page to Unix Latin-1:
  453 
  454             dos2unix -iso -n in.txt out.txt
  455 
  456         Convert from DOS CP850 to Unix Latin-1:
  457 
  458             dos2unix -850 -n in.txt out.txt
  459 
  460         Convert from Windows CP1252 to Unix Latin-1:
  461 
  462             dos2unix -1252 -n in.txt out.txt
  463 
  464         Convert from Windows CP1252 to Unix UTF-8 (Unicode):
  465 
  466             iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt
  467 
  468         Convert from Unix Latin-1 to DOS default code page:
  469 
  470             unix2dos -iso -n in.txt out.txt
  471 
  472         Convert from Unix Latin-1 to DOS CP850:
  473 
  474             unix2dos -850 -n in.txt out.txt
  475 
  476         Convert from Unix Latin-1 to Windows CP1252:
  477 
  478             unix2dos -1252 -n in.txt out.txt
  479 
  480         Convert from Unix UTF-8 (Unicode) to Windows CP1252:
  481 
  482             unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt
  483 
  484         See also <http://czyborra.com/charsets/codepages.html> and
  485         <http://czyborra.com/charsets/iso8859.html>.
  486 
  487 UNICODE
  488   Encodings
  489     There exist different Unicode encodings. On Unix and Linux Unicode files
  490     are typically encoded in UTF-8 encoding. On Windows Unicode text files
  491     can be encoded in UTF-8, UTF-16, or UTF-16 big endian, but are mostly
  492     encoded in UTF-16 format.
  493 
  494   Conversion
  495     Unicode text files can have DOS, Unix or Mac line breaks, like regular
  496     text files.
  497 
  498     All versions of dos2unix and unix2dos can convert UTF-8 encoded files,
  499     because UTF-8 was designed for backward compatibility with ASCII.
  500 
  501     Dos2unix and unix2dos with Unicode UTF-16 support, can read little and
  502     big endian UTF-16 encoded text files. To see if dos2unix was built with
  503     UTF-16 support type "dos2unix -V".
  504 
  505     On Unix/Linux UTF-16 encoded files are converted to the locale character
  506     encoding. Use the locale(1) command to find out what the locale
  507     character encoding is. When conversion is not possible a conversion
  508     error will occur and the file will be skipped.
  509 
  510     On Windows UTF-16 files are by default converted to UTF-8. UTF-8
  511     formatted text files are well supported on both Windows and Unix/Linux.
  512 
  513     UTF-16 and UTF-8 encoding are fully compatible, there will no text be
  514     lost in the conversion. When an UTF-16 to UTF-8 conversion error occurs,
  515     for instance when the UTF-16 input file contains an error, the file will
  516     be skipped.
  517 
  518     When option "-u" is used, the output file will be written in the same
  519     UTF-16 encoding as the input file. Option "-u" prevents conversion to
  520     UTF-8.
  521 
  522     Dos2unix and unix2dos have no option to convert UTF-8 files to UTF-16.
  523 
  524     ISO and 7-bit mode conversion do not work on UTF-16 files.
  525 
  526   Byte Order Mark
  527     On Windows Unicode text files typically have a Byte Order Mark (BOM),
  528     because many Windows programs (including Notepad) add BOMs by default.
  529     See also <http://en.wikipedia.org/wiki/Byte_order_mark>.
  530 
  531     On Unix Unicode files typically don't have a BOM. It is assumed that
  532     text files are encoded in the locale character encoding.
  533 
  534     Dos2unix can only detect if a file is in UTF-16 format if the file has a
  535     BOM. When an UTF-16 file doesn't have a BOM, dos2unix will see the file
  536     as a binary file.
  537 
  538     Use option "-ul" or "-ub" to convert an UTF-16 file without BOM.
  539 
  540     Dos2unix writes by default no BOM in the output file. With option "-b"
  541     Dos2unix writes a BOM when the input file has a BOM.
  542 
  543     Unix2dos writes by default a BOM in the output file when the input file
  544     has a BOM. Use option "-r" to remove the BOM.
  545 
  546     Dos2unix and unix2dos write always a BOM when option "-m" is used.
  547 
  548   Unicode file names on Windows
  549     Dos2unix has optional support for reading and writing Unicode file names
  550     in the Windows Command Prompt. That means that dos2unix can open files
  551     that have characters in the name that are not part of the default system
  552     ANSI code page. To see if dos2unix for Windows was built with Unicode
  553     file name support type "dos2unix -V".
  554 
  555     There are some issues with displaying Unicode file names in a Windows
  556     console. See option "-D", "--display-enc". The file names may be
  557     displayed wrongly in the console, but the files will be written with the
  558     correct name.
  559 
  560   Unicode examples
  561     Convert from Windows UTF-16 (with BOM) to Unix UTF-8:
  562 
  563         dos2unix -n in.txt out.txt
  564 
  565     Convert from Windows UTF-16LE (without BOM) to Unix UTF-8:
  566 
  567         dos2unix -ul -n in.txt out.txt
  568 
  569     Convert from Unix UTF-8 to Windows UTF-8 with BOM:
  570 
  571         unix2dos -m -n in.txt out.txt
  572 
  573     Convert from Unix UTF-8 to Windows UTF-16:
  574 
  575         unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt
  576 
  577 GB18030
  578     GB18030 is a Chinese government standard. A mandatory subset of the
  579     GB18030 standard is officially required for all software products sold
  580     in China. See also <http://en.wikipedia.org/wiki/GB_18030>.
  581 
  582     GB18030 is fully compatible with Unicode, and can be considered an
  583     unicode transformation format. Like UTF-8, GB18030 is compatible with
  584     ASCII. GB18030 is also compatible with Windows code page 936, also known
  585     as GBK.
  586 
  587     On Unix/Linux UTF-16 files are converted to GB18030 when the locale
  588     encoding is set to GB18030. Note that this will only work if the locale
  589     is supported by the system. Use command "locale -a" to get the list of
  590     supported locales.
  591 
  592     On Windows you need to use option "-gb" to convert UTF-16 files to
  593     GB18030.
  594 
  595     GB18030 encoded files can have a Byte Order Mark, like Unicode files.
  596 
  597 EXAMPLES
  598     Read input from 'stdin' and write output to 'stdout':
  599 
  600         dos2unix < a.txt
  601         cat a.txt | dos2unix
  602 
  603     Convert and replace a.txt. Convert and replace b.txt:
  604 
  605         dos2unix a.txt b.txt
  606         dos2unix -o a.txt b.txt
  607 
  608     Convert and replace a.txt in ascii conversion mode:
  609 
  610         dos2unix a.txt
  611 
  612     Convert and replace a.txt in ascii conversion mode, convert and replace
  613     b.txt in 7bit conversion mode:
  614 
  615         dos2unix a.txt -c 7bit b.txt
  616         dos2unix -c ascii a.txt -c 7bit b.txt
  617         dos2unix -ascii a.txt -7 b.txt
  618 
  619     Convert a.txt from Mac to Unix format:
  620 
  621         dos2unix -c mac a.txt
  622         mac2unix a.txt
  623 
  624     Convert a.txt from Unix to Mac format:
  625 
  626         unix2dos -c mac a.txt
  627         unix2mac a.txt
  628 
  629     Convert and replace a.txt while keeping original date stamp:
  630 
  631         dos2unix -k a.txt
  632         dos2unix -k -o a.txt
  633 
  634     Convert a.txt and write to e.txt:
  635 
  636         dos2unix -n a.txt e.txt
  637 
  638     Convert a.txt and write to e.txt, keep date stamp of e.txt same as
  639     a.txt:
  640 
  641         dos2unix -k -n a.txt e.txt
  642 
  643     Convert and replace a.txt, convert b.txt and write to e.txt:
  644 
  645         dos2unix a.txt -n b.txt e.txt
  646         dos2unix -o a.txt -n b.txt e.txt
  647 
  648     Convert c.txt and write to e.txt, convert and replace a.txt, convert and
  649     replace b.txt, convert d.txt and write to f.txt:
  650 
  651         dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
  652 
  653 RECURSIVE CONVERSION
  654     In a Unix shell the find(1) and xargs(1) commands can be used to run
  655     dos2unix recursively over all text files in a directory tree. For
  656     instance to convert all .txt files in the directory tree under the
  657     current directory type:
  658 
  659         find . -name '*.txt' -print0 |xargs -0 dos2unix
  660 
  661     The find(1) option "-print0" and corresponding xargs(1) option -0 are
  662     needed when there are files with spaces or quotes in the name. Otherwise
  663     these options can be omitted. Another option is to use find(1) with the
  664     "-exec" option:
  665 
  666         find . -name '*.txt' -exec dos2unix {} \;
  667 
  668     In a Windows Command Prompt the following command can be used:
  669 
  670         for /R %G in (*.txt) do dos2unix "%G"
  671 
  672     PowerShell users can use the following command in Windows PowerShell:
  673 
  674         get-childitem -path . -filter '*.txt' -recurse | foreach-object {dos2unix $_.Fullname}
  675 
  676 LOCALIZATION
  677     LANG
  678         The primary language is selected with the environment variable LANG.
  679         The LANG variable consists out of several parts. The first part is
  680         in small letters the language code. The second is optional and is
  681         the country code in capital letters, preceded with an underscore.
  682         There is also an optional third part: character encoding, preceded
  683         with a dot. A few examples for POSIX standard type shells:
  684 
  685             export LANG=nl               Dutch
  686             export LANG=nl_NL            Dutch, The Netherlands
  687             export LANG=nl_BE            Dutch, Belgium
  688             export LANG=es_ES            Spanish, Spain
  689             export LANG=es_MX            Spanish, Mexico
  690             export LANG=en_US.iso88591   English, USA, Latin-1 encoding
  691             export LANG=en_GB.UTF-8      English, UK, UTF-8 encoding
  692 
  693         For a complete list of language and country codes see the gettext
  694         manual:
  695         <http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
  696         -Codes.html>
  697 
  698         On Unix systems you can use the command locale(1) to get locale
  699         specific information.
  700 
  701     LANGUAGE
  702         With the LANGUAGE environment variable you can specify a priority
  703         list of languages, separated by colons. Dos2unix gives preference to
  704         LANGUAGE over LANG. For instance, first Dutch and then German:
  705         "LANGUAGE=nl:de". You have to first enable localization, by setting
  706         LANG (or LC_ALL) to a value other than "C", before you can use a
  707         language priority list through the LANGUAGE variable. See also the
  708         gettext manual:
  709         <http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
  710         ariable.html>
  711 
  712         If you select a language which is not available you will get the
  713         standard English messages.
  714 
  715     DOS2UNIX_LOCALEDIR
  716         With the environment variable DOS2UNIX_LOCALEDIR the LOCALEDIR set
  717         during compilation can be overruled. LOCALEDIR is used to find the
  718         language files. The GNU default value is "/usr/local/share/locale".
  719         Option --version will display the LOCALEDIR that is used.
  720 
  721         Example (POSIX shell):
  722 
  723             export DOS2UNIX_LOCALEDIR=$HOME/share/locale
  724 
  725 RETURN VALUE
  726     On success, zero is returned. When a system error occurs the last system
  727     error will be returned. For other errors 1 is returned.
  728 
  729     The return value is always zero in quiet mode, except when wrong
  730     command-line options are used.
  731 
  732 STANDARDS
  733     <http://en.wikipedia.org/wiki/Text_file>
  734 
  735     <http://en.wikipedia.org/wiki/Carriage_return>
  736 
  737     <http://en.wikipedia.org/wiki/Newline>
  738 
  739     <http://en.wikipedia.org/wiki/Unicode>
  740 
  741 AUTHORS
  742     Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
  743     mode) - <wuebben@kde.org>, Christian Wurll (add extra newline) -
  744     <wurll@ira.uka.de>, Erwin Waterlander - <waterlan@xs4all.nl>
  745     (maintainer)
  746 
  747     Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
  748 
  749     SourceForge page: <http://sourceforge.net/projects/dos2unix/>
  750 
  751 SEE ALSO
  752     file(1) find(1) iconv(1) locale(1) xargs(1)
  753