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