Backed out changeset: 503d446c0a64

This commit is contained in:
emb
2015-02-24 20:35:59 -06:00
parent 1f084f3ca6
commit dbf51f62d8
60 changed files with 0 additions and 36440 deletions

View File

@@ -1,3 +0,0 @@
This was downloaded from http://waterlan.home.xs4all.nl/dos2unix.html
dos2unix-7.2-win32.zip Windows 32 bit version.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,19 +0,0 @@
KNOWN BUGS
querycp.c: query_con_codepage()
The DOS 16 and 32 bit versions compiled with OpenWatcom report
a wrong active code page under Windows 98.
A correct code page is reported under FreeDOS.
REPORTING BUGS
Report bugs at the dos2unix SourceForge page
http://sourceforge.net/projects/dos2unix/
Bugs tracker: http://sourceforge.net/p/dos2unix/bugs/
Also patches and feature requests can be entered under the
"Tickets" tab.
or send an email to Erwin Waterlander <waterlan@xs4all.nl>

View File

@@ -1,30 +0,0 @@
The dos2unix package is distributed under FreeBSD style license.
See also http://www.freebsd.org/copyright/freebsd-license.html
--------
Copyright (C) 2009-2015 Erwin Waterlander
Copyright (C) 1998 Christian Wurll
Copyright (C) 1998 Bernd Johannes Wuebben
Copyright (C) 1994-1995 Benjamin Lin.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice in the documentation and/or other materials provided with
the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

View File

@@ -1,310 +0,0 @@
PREREQUISITES
Using GCC:
Required
* gcc : GNU C compiler
* GNU binutils : A collection of binary tools
* GNU make : make
* sh : POSIX type shell
* GNU coreutils: Core utilities package (chmod, install, mkdir,
mv, rm, uname)
Optional (depending on build targets):
* perl : Practical Extraction and Report Language
perl >= 5.10.1 is required for rebuilding the
manual pages with perlpod.
Self-tests require module perl-Test-Simple.
* gettext : Framework to help GNU packages produce multi-
lingual messages.
* po4a : PO for anything, for rebuilding manuals.
* groff : GNU troff text formatting system, for
international messages and manuals.
* ghostscript : An interpreter for the PostScript language and
for PDF (ps2pdf)
Using LLVM CLANG:
Clang can be used as a drop-in replacement for gcc. Just add CC=clang to the make
command line.
Using Watcom C:
Required
* Open Watcom : http://www.openwatcom.org/
* Open Watcom V2 : http://open-watcom.github.io/open-watcom/ (git repo)
http://sourceforge.net/projects/openwatcom/ (binaries download)
Using Microsoft Visual C++:
Required
* Visual C++ : You can get a free express version via this web page:
http://www.visualstudio.com/products/visual-studio-express-vs
Download Visual Studio for Windows Desktop. Visual C++ is part
of Visual Studio. Out of the box compilation for 64-bit
applications is supported since version 2012.
BASIC INSTALLATION
To build the program type:
make
To run the self-tests type:
make check
To strip the executables:
make strip
To install:
make install
Clean:
make clean
SELF-TESTS
To run the self-tests you need a Perl installation including
module perl-Test-Simple.
To check the native Windows ports you need to run the tests in
the MSYS2 shell.
INSTALLATION NAMES
By default the 'install' target will install the program in
/usr/bin, the language files in /usr/share/locale
and the man page in /usr/share/man. You can specify an
installation prefix other than /usr by modifying the
'prefix' variable. An Example:
make prefix=$HOME clean all
make prefix=$HOME install
DEBUG
A debug enabled build can be made by adding DEBUG=1
to the make command. Example:
make clean install DEBUG=1
With debug enabled dos2unix will print extra information
and you can debug the source code in gdb.
NATIVE LANGUAGE SUPPORT
Native Language Support (NLS) is by default enabled.
To disable NLS add ENABLE_NLS=. Example:
make clean install ENABLE_NLS=
INTERNATIONAL MAN PAGES
Since dos2unix 6.0.5 all man pages are encoded in UTF-8, because even
Western-European man pages may contain Unicode characters not supported by
the Latin-1 (ISO-8859-1) character set.
Originally the Unix man system supported only man pages in Latin1 format.
Although the world is moving to Unicode format (UTF-8) there is still a lot
of Latin1 legacy around.
The English man page is a pure ASCII file and is readable on all platforms.
Non-English man pages are encoded in UTF-8. These do not show properly on
old systems. Man pages in UTF-8 format are shown properly on Linux. Not
all roff implementations support UTF-8.
In order to show UTF-8 man pages properly on Cygwin with traditional man
you need to do the following:
In /etc/man.conf, change the NROFF definition to use 'preconv'.
NROFF /usr/bin/preconv | /usr/bin/nroff -c -mandoc 2>/dev/null
To view the man page set the correct locale. E.g. for Ukrainian:
export LANG=uk_UA.UTF-8
man dos2unix
With man-db the manpages show correctly out of the box. Cygwin changed to
use man-db in June 2014.
Man-db is the default man system on the major Linux distributions.
LARGE FILE SUPPORT
Large File Support (LFS) is by default enabled. This enables
the use of 64 bit file system interface on 32 bit systems.
This makes it possible to open files larger than 2GB on 32 bit
systems, provided the OS has LFS support builtin.
To disable LFS make the LFS variable empty. Example:
Disable LFS:
make clean install LFS=
The gcc compiler from the mingw.org project does not support LFS.
It is advised to use the mingw-w64 compiler tool chain for LFS on
32 bit Windows.
UNICODE SUPPORT
Unicode UTF-16 support is by default enabled for Windows and Unix. To
disable make the UCS variable (Universal Character Set) empty.
Disable Unicode:
make clean install UCS=
Unicode UTF-16 is not supported by the DOS and OS/2 versions.
DOCUMENTATION
Manual pages are generated from Perl POD files.
The manual pages in text and html format are by default only
created in English language. To create text and html manuals
for other languages type:
make txt
make html
Once the manuals in non-English languages have been created,
they will also be installed under share/doc/ when you type
'make install'
Manuals in PDF format are by default not created.
To create manuals in PDF format type:
make pdf
PDF generation requires GhostScript to be installed.
WINDOWS 32 BIT PORT
Using Mingw compiler <http://www.mingw.org>:
make -f mingw.mak clean
make -f mingw.mak
make -f mingw.mak strip
make -f mingw.mak install
Using MinGW-w64 compiler <http://mingw-w64.sourceforge.net>:
I am using the MSYS2 project <http://sourceforge.net/projects/msys2/>
which includes the MinGW-w64 compiler and an updated MSYS shell based
on Cygwin 1.7.
make -f mingw32.mak clean
make -f mingw32.mak
make -f mingw32.mak strip
make -f mingw32.mak install
Or use Open Watcom and type:
wmake -f wccwin32.mak clean
wmake -f wccwin32.mak
wmake -f wccwin32.mak install
Or use Microsoft Visual C++ and type:
nmake /f vc.mak clean
nmake /f vc.mak
nmake /f vc.mak install
The win32 binaries built with MinGW32 are packed with a patched version of
MinGW's libintl-8.dll that has builtin support for relocation. See also
http://waterlan.home.xs4all.nl/libintl.html and
http://sourceforge.net/p/mingw/bugs/1808/
The MSYS2 project has the relocation patch already included.
WINDOWS 64 BIT PORT
To compile a version for 64 bit Windows, get the Mingw-w64 compiler
<http://mingw-w64.sourceforge.net>, and use makefile mingw64.mak:
I am using the MSYS2 project <http://sourceforge.net/projects/msys2/>
which includes the MinGW-w64 compiler and an updated MSYS shell based
on Cygwin 1.7.
make -f mingw64.mak clean
make -f mingw64.mak
make -f mingw64.mak strip
make -f mingw64.mak install
Or use Microsoft Visual C++. Visual Studio Express supports
out of the box C/C++ compilation for 64-bit applications since
version 2012. Start an "x64 Cross Tools Command Prompt" and
type:
nmake /f vc.mak clean
nmake /f vc.mak
nmake /f vc.mak install
DOS PORT, 32 BIT
To compile a version for DOS, get the DJGPP compiler
<http://www.delorie.com/djgpp/>, and use makefile djgpp.mak.
DJGPP gcc >= 4.6 seems to cause problems. Crashes of gcc itself,
or crashing dos2unix binaries (seen in DOSBox and DOSEMU).
Use DJGPP gcc <= 4.5.3.
make -f djgpp.mak clean
make -f djgpp.mak
make -f djgpp.mak strip
make -f djgpp.mak install
Or use Open Watcom
Cross compiling from Windows 32 bit. This works.
wmake -f wccdos32.mak clean
wmake -f wccdos32.mak
wmake -f wccdos32.mak install
DOS PORT, 16 BIT
To compile a version for DOS, use the Borland C compiler 3.1 or 4.0,
and use makefile bcc.mak:
make -f bcc.mak clean
make -f bcc.mak
Or use Open Watcom
wmake -f wccdos16.mak clean
wmake -f wccdos16.mak
wmake -f wccdos16.mak install
OS/2 PORT
Using EMX
make -f emx.mak clean
make -f emx.mak
make -f emx.mak strip
make -f emx.mak install
Open Watcom
wmake -f wccos2.mak clean
wmake -f wccos2.mak
wmake -f wccos2.mak install

View File

@@ -1,186 +0,0 @@
2015-02-11: Version 7.2
* New: Japanese translation of the UI messages.
* New: Support Chinese GB18030 locale.
* Change: On Unix/Linux convert UTF-16 to the locale encoding. It is
no longer required that the locale encoding is UTF-8.
2014-10-06: Version 7.1
* New: Option -i, --info to print file information.
This new option prints number of DOS, Unix, and Mac line breaks, the byte
order mark, and if the file is text or binary. And it can print the names
of files that would be converted.
2014-09-09: Version 7.0
* New: automated self-tests.
* New: option -u to keep UTF-16 encoding.
* New: option -v to print information about BOMs and converted line breaks.
* Change: stdio mode does not automatically set quiet mode.
* Change: stdio mode does not automatically force conversion of binaries.
An error is returned when the stdin stream contains a binary symbol.
* Bugfix: dos2unix -l created DOS line breaks from Mac line breaks.
* Bugfix: system error number was not always returned.
* Bugfix: an Unicode input file disabled 7bit and iso mode for next input files.
* Bugfix: mac2unix help text, options -b and -r.
* The code has been cleaned up.
2014-08-03: Version 6.0.6
* Bugfix: 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
* Dos2unix is part of the Translation Project (TP).
All translations go via the Translation Project.
See http://translationproject.org/
* New translations of UI messages: Brazilian Portuguese, Chinese (traditional),
Danish, French, Hungarian, Polish, Serbian, Ukrainian, Vietnamese.
* New translations of the manual: Brazilian Portuguese, French, German,
Polish, Ukrainian.
* Generated man pages are included in the source package to prevent
compilation problems with very old or very new perl/pod2man versions.
* Manuals are now generated from gettext PO files with po4a for easier
translation.
* All manuals are now in UTF-8 encoding.
* Skip symbolic links on Windows by default (same as on Unix).
2013-12-30: Version 6.0.4
* New options -ul and -ub to convert UTF-16 files without BOM.
* New Russian translation of the messages.
* Build 32 bit Windows binaries with Large File Support (LFS)
by using mingw-w64 for 32 bit Windows.
* When a binary symbol is encountered the value is printed.
2013-01-25: Version 6.0.3
* Source code compiles with Microsoft Visual C.
* Print system error when writing output fails.
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
* Update Spanish translations.
* Update manual.
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 compilation error when debug was enabled.
2012-01-27: Version 5.3.2
* New homepage URL: http://waterlan.home.xs4all.nl/dos2unix.html
* Compiles for native MSYS.
* Compile with OpenWatcom for DOS32 and Win32.
* Detect code page on OS/2.
* Support wild cards on OS/2.
2011-08-09: Version 5.3.1
* Spanish translation of messages and manual.
* File ownership is maintained in old file mode (Unix only).
* Dos2unix and Unix2dos share the same language files.
* Code cleanup.
2011-04-26: Version 5.3
* Improved handling of symbolic links. New options -F, -R, -S.
* Improved handling and reporting of errors.
* Source code improvements for Cygwin. Behave exactly as on Linux.
* New option --. Treat all following options as file names.
2011-03-04: Version 5.2.1
* PDF and PostScript generation is optional. No default dependency on
GhostScript and Groff.
* Enable optional Large File Support (LFS).
* Esperanto x-notation is optional. No longer installation of non-standard
locale 'eo-x'.
* Improved error messages.
2011-01-31: Version 5.2
* ISO conversion mode supports same DOS code pages as SunOS dos2unix does:
CP437 (US), CP850 (Western European), CP860 (Portuguese),
CP863 (French Canadian), and CP865 (Nordic).
* ISO conversion mode supports Windows code page CP1252 (Western).
* SunOS compatible options -ascii, -iso, -7, -437, -850, -860, -863, and -865.
* Active code page detection for ISO mode.
* Fixed ISO conversion of non-breaking space (NBSP).
* ISO and 7bit mode can be used in Mac mode.
* Treat ASCII Form Feed control characters as valid text.
* Update manual pages.
* Don't include generated documentation files in Unix source package.
* Create a source package in DOS text format.
2010-08-18: Version 5.1.1
* Added Dutch translation of the manual.
* Win64 port.
* Win32 binary package uses patched MinGW's libintl, with builtin
* relocation support.
* Support compilation in DOSBox (8.3 file names where needed).
* Fixed compilation on Darwin OS.
2010-04-03: Version 5.1
* Esperanto translations have been added.
* Ports to 16 bit DOS have been made.
* Command-line options can be set in stdio mode.
* Bugfix dos2unix MAC mode: Don't change DOS line endings.
* Create stubs for DOS32 versions of mac2unix and unix2mac.
* Localization information has been added to the manual.
* Man pages have been merged.
* Man page generation from Perl POD file.
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.

View File

@@ -1,169 +0,0 @@
dos2unix - DOS/Mac to Unix and vice versa text file format converter.
FILE LIST
README.txt : This file.
INSTALL.txt : How to build and install.
COPYING.txt : distribution license.
NEWS.txt : Basic change log for users.
ChangeLog.txt : Detailed change log for programmers.
TODO.txt : Things to do.
BUGS.txt : Known bugs and instructions on reporting new ones.
man/man1/dos2unix.txt : Dos2unix manual, text format.
man/man1/dos2unix.htm : Dos2unix manual, HTML format.
PROJECT HOME PAGE
http://waterlan.home.xs4all.nl/dos2unix.html
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
* Native language support.
* Automatically skips binary and non-regular files.
* In-place, paired, or stdio mode conversion.
* Keep original file dates option.
* 7-bit and iso conversion modes like SunOS dos2unix.
* Conversion of Unicode UTF-16 files.
* Handles Unicode Byte Order Mark (BOM).
* Display file information.
* Secure.
AUTHORS
Erwin Waterlander version 3.2-7.2 2009-2015
Christian Wurll version 3.1 1998
Bernd Johannes Wuebben version 3.0 1998
Benjamin Lin version 1.1-2.3 1994-1995
John Birchfield version 1.0 1989
TRANSLATORS
Since verion 6.0.5 dos2unix is part of the Translation Project (TP).
All translations go via the Translation Project.
Translation of the messages.
See http://translationproject.org/domain/dos2unix.html
Brazilian Portuguese Enrico Nicoletto Version 6.0.5
Brazilian Portuguese Rafael Ferreira Version 6.0.6 - 7.2
Chinese (traditional) mail6543210 Version 6.0.5
Danish Thomas Pryds Version 6.0.5 - 6.0.6
Dutch Erwin Waterlander Version 4.0 - 6.0.4
Dutch Benno Schulenberg Version 6.0.5 - 7.2
Esperanto Rugxulo Version 5.1 - 6.0.4
Esperanto Benno Schulenberg Version 6.0.5 - 7.1
French Frédéric Marchal Version 6.0.5 - 7.2
German Philipp Thomas Version 5.0 - 6.0.3, 7.0
German Lars Wendler Version 6.0.4
German Mario Blättermann Version 6.0.6, 7.1 - 7.2
Hungarian Balázs Úr Version 6.0.5 - 7.1
Japanese Yasuaki Taniguchi Version 7.1.1
Norwegian Bokmaal Åka Sikrom Version 6.0.6 - 7.2
Polish Jakub Bogusz Version 6.0.5 - 7.2
Russian Андрей Углик (Andrei Uhlik) Version 6.0.4
Russian Yuri Kozlov Version 6.0.6 - 7.1
Serbian Мирослав Николић Version 6.0.5 - 6.0.6
Spanish Julio A. Freyre-Gonzalez Version 5.3.1 - 6.0.4
Spanish Enrique Lazcorreta Puigmartí Version 6.0.6 - 7.2
Ukrainian Yuri Chornoivan Version 6.0.5 - 7.2
Vietnamese Trần Ngọc Quân Version 6.0.5 - 7.2
Translation of the manual.
See http://translationproject.org/domain/dos2unix-man.html
Brazilian Portuguese Rafael Ferreira Version 6.0.5 - 7.2
Dutch Erwin Waterlander Version 5.1.1 - 6.0.4
Dutch Benno Schulenberg Version 6.0.5 - 7.2
French Frédéric Marchal Version 6.0.5 - 7.2
German Mario Blättermann Version 6.0.5 - 7.2
Polish Jakub Bogusz Version 6.0.5 - 7.2
Spanish Julio A. Freyre-Gonzalez Version 5.3.1 - 6.0.4
Spanish Enrique Lazcorreta Puigmartí Version 6.0.6 - 7.2
Ukrainian Yuri Chornoivan Version 6.0.5 - 7.2
ACKNOWLEDGEMENTS
Rugxulo query_con_codepage(), code page detection in DOS.
Rugxulo DJGPP stubs for mac2unix and unix2mac.
Jari Aalto Improvements man page.
Jari Aalto Improvements Makefile.
Ben Pfaff Treat form feeds as valid text.
Marc Gianzero Darwin OS port.
Elbert Pol OS/2 port.
Tim Waugh Various patches.
Mike Harris Man page update.
Bernard RosenKraenzer segfault patch.
Tim Powers mkstemp patch.
Miloslav Trmac safeconv patch.
Charles Wilson Follow symbolic links.
Charles Wilson Makefile and code cleanup for Cygwin.
Christopher Williams Maintain file ownership in old file mode.
Steven H. Levine Support wildcard expansion on OS/2.
Steve Hay Support wildcard expansion on win64.
Michael Schindler Fixed compiler warning.
Somsak Pattanaprateep Print line number when binary symbol is found.
Justin Lecher Makefile improvement.
F.J. Brandelik Reported problems when win32 version processes
huge files on a network drive.
Benno Schulenberg Cleaning up the UI messages.
Mario Blättermann Generate pod files from gettext po files with po4a.
Daniel Macks Reported dependency on GNU sed.
Alan S. Jones Reported bug in UTF-16 conversion by mac2unix.
Alan S. Jones Idea for an info option, to list file statistics
about line breaks and byte order marks.
Gary Johnson Idea for an info option, to list only files which have
DOS line breaks, or only files with Unix line breaks.
Helmut Karlowski Makefile and PrintVersion() update for freeMiNT.
Tom Christiansen Fix for wrong title in HTML manuals.
Armin Müller Fixed typo in if condition in write_bom().
FINDUTILS
Windows users who are looking for the Unix 'find' and 'xargs' commands
can find them in the findutils package for Windows at the ezwinports
project page at: http://sourceforge.net/projects/ezwinports/files/
A DOS version of the findutils package can be obtained from the DJGPP
project (http://www.delorie.com/djgpp/) at
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/
CONTACT INFORMATION
Project home page : http://waterlan.home.xs4all.nl/dos2unix.html
SourceForge project page : http://sourceforge.net/projects/dos2unix/
Erwin Waterlander
waterlan@xs4all.nl
http://waterlan.home.xs4all.nl/
If you need support you can email me directly or make a ticket on the
SourceForge project page. Help in any form is appreciated. A problem
report, a fix, or just a remark.

View File

@@ -1,20 +0,0 @@
TO DO
=====
* Translations.
All translations are going via the Translation Project.
User interface messages:
See http://translationproject.org/domain/dos2unix.html
Manual:
See http://translationproject.org/domain/dos2unix-man.html
* Support writing to symbolic link targets of Windows native
symbolic links (Windows Vista and up).
* Keep original owner in old file mode, on Windows.

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - Formatumwandlung für Textdateien von DOS/Mac nach Unix und umgekehrt</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#BEZEICHNUNG">BEZEICHNUNG</a></li>
<li><a href="#BERSICHT">&Uuml;BERSICHT</a></li>
<li><a href="#BESCHREIBUNG">BESCHREIBUNG</a></li>
<li><a href="#OPTIONEN">OPTIONEN</a></li>
<li><a href="#MAC-MODUS">MAC-MODUS</a></li>
<li><a href="#UMWANDLUNGSMODI">UMWANDLUNGSMODI</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Zeichenkodierungen">Zeichenkodierungen</a></li>
<li><a href="#Umwandlung">Umwandlung</a></li>
<li><a href="#Markierung-der-Bytereihenfolge">Markierung der Bytereihenfolge</a></li>
<li><a href="#Unicode-Beispiele">Unicode-Beispiele</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#BEISPIELE">BEISPIELE</a></li>
<li><a href="#REKURSIVE-UMWANDLUNG">REKURSIVE UMWANDLUNG</a></li>
<li><a href="#LOKALISIERUNG">LOKALISIERUNG</a></li>
<li><a href="#RCKGABEWERT">R&Uuml;CKGABEWERT</a></li>
<li><a href="#STANDARDS">STANDARDS</a></li>
<li><a href="#AUTOREN">AUTOREN</a></li>
<li><a href="#SIEHE-AUCH">SIEHE AUCH</a></li>
</ul>
<h1 id="BEZEICHNUNG">BEZEICHNUNG</h1>
<p>dos2unix - Formatumwandlung f&uuml;r Textdateien von DOS/Mac nach Unix und umgekehrt</p>
<h1 id="BERSICHT">&Uuml;BERSICHT</h1>
<pre><code> dos2unix [Optionen] [DATEI &hellip;] [-n EINGABEDATEI AUSGABEDATEI &hellip;]
unix2dos [Optionen] [DATEI &hellip;] [-n EINGABEDATEI AUSGABEDATEI &hellip;]</code></pre>
<h1 id="BESCHREIBUNG">BESCHREIBUNG</h1>
<p>Das Paket Dos2unix enth&auml;lt die Werkzeuge <code>dos2unix</code> und <code>unix2dos</code> zum Umwandeln einfacher Textdateien aus dem DOS- oder Mac-Format in das Unix-Format und umgekehrt.</p>
<p>In Textdateien unter DOS/Windows sind Zeilenumbr&uuml;che, auch als neue Zeile (NL) bekannt, eine Kombination aus zwei Zeichen: einem Wagenr&uuml;cklauf (Carriage Return, CR) gefolgt von einem Zeilenvorschub (Line Feed, LF). In Unix-Textdateien bestehen Zeilenumbr&uuml;che nur aus einem Zeichen, dem Zeilenvorschub (LF). In Mac-Textdateien aus der Zeit vor MacOSX bestand ein Zeilenumbruch aus einem einzelnen CR-Zeichen. Heute verwendet Mac OS Zeilenumbr&uuml;che im Unix-Stil (LF).</p>
<p>Neben Zeilenumbr&uuml;chen kann Dos2unix auch die Zeichenkodierung von Dateien umwandeln. Einige DOS-Codepages k&ouml;nnen in Unix Latin-1 umgewandelt werden, und Windows-Unicode-Dateien (UTF-16) k&ouml;nnen in Unix-Unicode-Dateien (UTF-8) umgewandelt werden.</p>
<p>Bin&auml;rdateien werden automatisch &uuml;bersprungen, sofern die Umwandlung nicht erzwungen wird.</p>
<p>Nicht-regul&auml;re Dateien, wie Verzeichnisse und FIFOS (Weiterleitungen) werden automatisch &uuml;bersprungen.</p>
<p>Symbolische Links und deren Ziele werden per Vorgabe unver&auml;ndert belassen. Symbolische Links k&ouml;nnen optional ersetzt werden, oder die Ausgabe wird in das Ziel des symbolischen Links geschrieben. Unter Windows wird das Schreiben in das Ziel eines symbolischen Links nicht unterst&uuml;tzt.</p>
<p>Dos2unix wurde nach dem Vorbild der dos2unix-Version unter SunOS/Solaris entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese Version ersetzt per Vorgabe Dateien bei der Umwandlung (Alte-Datei-Modus), w&auml;hrend unter SunOS/Solaris nur die paarweise Umwandlung (Neue-Datei-Modus) unterst&uuml;tzt wird. Siehe dazu die Optionen <code>-o</code> und <code>-n</code>.</p>
<h1 id="OPTIONEN">OPTIONEN</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese Option, wenn Sie Dateien umwandeln wollen, deren Namen mit einem Minuszeichen beginnen. Um beispielsweise eine Datei namens &raquo;-bla&laquo; umzuwandeln, k&ouml;nnen Sie folgenden Befehl verwenden:</p>
<pre><code> dos2unix -- -bla</code></pre>
<p>oder im Neue-Datei-Modus:</p>
<pre><code> dos2unix -n -- -bla ausgabe.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>wandelt nur Zeilenumbr&uuml;che um. Dies ist der vorgegebene Umwandlungsmodus.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>wandelt aus dem DOS- in den ISO-8859-1-Zeichensatz um. Weitere Informationen hierzu finden Sie im Abschnitt UMWANDLUNGSMODI.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>verwendet die Windows-Codepage 1252 (Westeurop&auml;isch).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>verwendet die DOS-Codepage 437 (US). Dies ist die vorgegebene Codepage f&uuml;r die ISO-Umwandlung.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>verwendet die DOS-Codepage 850 (Westeurop&auml;isch).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>verwendet die DOS-Codepage 860 (Portugiesisch).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>verwendet die DOS-Codepage 863 (Kanadisches Franz&ouml;sisch).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>verwendet die DOS-Codepage 865 (Skandinavisch).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>wandelt 8bit-Zeichen in ein 7bit-Bitmuster um.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>erh&auml;lt die Markierung der Bytereihenfolge (BOM). Wenn die Eingabedatei eine BOM enth&auml;lt, wird ebenfalls eine BOM in die Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von DOS-Zeilenumbr&uuml;chen. Siehe auch die Option <code>-r</code>.</p>
</dd>
<dt id="c---convmode-UMWANDLUNGSMODUS"><b>-c, --convmode UMWANDLUNGSMODUS</b></dt>
<dd>
<p>legt den Umwandlungsmodus fest. UMWANDLUNGSMODUS kann <i>ascii</i>, <i>7bit</i>, <i>iso</i> oder <i>mac</i> sein, wobei <i>ascii</i> die Vorgabe ist.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>erzwingt die Umwandlung von Bin&auml;rdateien.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>wandelt unter Windows UTF-16-Dateien standardm&auml;&szlig;ig in UTF-8 um, ungeachtet der Einstellung der Locale. Verwenden Sie diese Option zum umwandeln von Utf-16-Dateien in GB18030. Diese Option ist nur unter Windows verf&uuml;gbar. Siehe auch Abschnitt GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>zeigt eine Hilfe an und beendet das Programm.</p>
</dd>
<dt id="i-SCHALTER---info-SCHALTER-DATEI"><b>-i[SCHALTER], --info[=SCHALTER] DATEI</b></dt>
<dd>
<p>zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.</p>
<p>Die Ausgabe der Informationen geschieht in der folgenden Reihenfolge: Anzahl der DOS-Zeilenumbr&uuml;che, Anzahl der Unix-Zeilenumbr&uuml;che, Anzahl der Mac-Zeilenumbr&uuml;che, Markierung der Bytereihenfolge, Text- oder Bin&auml;rformat, Dateiname.</p>
<p>Beispielausgabe:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Optionale zus&auml;tzliche Schalter k&ouml;nnen gesetzt werden, um die Ausgabe anzupassen. Einer oder mehrere Schalter k&ouml;nnen hinzugef&uuml;gt werden.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>gibt die Anzahl der DOS-Zeilenumbr&uuml;che aus.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>gibt die Anzahl der Unix-Zeilenumbr&uuml;che aus.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>gibt die Anzahl der Mac-Zeilenumbr&uuml;che aus.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>gibt die Markierung der Bytereihenfolge aus.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>zeigt an, ob es sich um eine Text- oder eine Bin&auml;rdatei handelt.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>gibt nur die Dateien aus, die umgewandelt werden w&uuml;rden.</p>
<p>Mit dem Schalter <code>c</code> gibt dos2unix nur die Dateien aus, die DOS-Zeilenumbr&uuml;che enthalten, unix2dos nur die Dateien mit Unix-Zeilenumbr&uuml;chen.</p>
</dd>
</dl>
<p>Beispiele:</p>
<p>Informationen zu allen *.txt-Dateien anzeigen:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Nur die Anzahl der DOS-Zeilenumbr&uuml;che und Unix-Zeilenumbr&uuml;che anzeigen:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Nur die Markierung der Bytereihenfolge anzeigen:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>Die Dateien auflisten, die DOS-Zeilenumbr&uuml;che enthalten:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>Die Dateien auflisten, die Unix-Zeilenumbr&uuml;che enthalten:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>&uuml;bernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>zeigt die Lizenz des Programms an.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>f&uuml;gt eine zus&auml;tzliche neue Zeile hinzu.</p>
<p><b>dos2unix</b>: Nur DOS-Zeilenumbr&uuml;che werden in Unix-Zeilenumbr&uuml;che umgewandelt. Im Mac-Modus werden nur Mac-Zeilenumbr&uuml;che in Unix-Zeilenumbr&uuml;che umgewandelt.</p>
<p><b>unix2dos</b>: Nur Unix-Zeilenumbr&uuml;che werden in DOS-Zeilenumbr&uuml;che umgewandelt. Im Mac-Modus werden nur Unix-Zeilenumbr&uuml;che in Mac-Zeilenumbr&uuml;che umgewandelt.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>schreibt eine Markierung der Bytereihenfolge (BOM) in die Ausgabedatei. In der Voreinstellung wird eine UTF-8-BOM geschrieben.</p>
<p>Wenn die Eingabedatei in UTF-16 kodiert ist und die Option <code>-u</code> verwendet wird, wird eine UTF-16-BOM geschrieben.</p>
<p>Verwenden Sie diese Option niemals, wenn die Kodierung der Ausgabedatei weder UTF-8 noch UTF-16 ist. Weitere Informationen finden Sie im Abschnitt UNICODE.</p>
</dd>
<dt id="n---newfile-EINGABEDATEI-AUSGABEDATEI"><b>-n, --newfile EINGABEDATEI AUSGABEDATEI &hellip;</b></dt>
<dd>
<p>Neue-Datei-Modus. Die EINGABEDATEI wird umgewandelt und in die AUSGABEDATEI geschrieben. Die Dateinamen m&uuml;ssen paarweise angegeben werden. Platzhalter sollten <i>nicht</i> verwendet werden, sonst werden Sie Ihre Dateien <i>verlieren</i>.</p>
<p>Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird Besitzer der umgewandelten Datei. Die Lese- und Schreibrechte werden aus den Zugriffsrechten der Originaldatei minus der umask(1) der Person ermittelt, die die Umwandlung ausgef&uuml;hrt hat.</p>
</dd>
<dt id="o---oldfile-DATEI"><b>-o, --oldfile DATEI &hellip;</b></dt>
<dd>
<p>Alte-Datei-Modus. Die DATEI wird umgewandelt und durch die Ausgabedatei &uuml;berschrieben. Per Vorgabe werden Umwandlungen in diesem Modus ausgef&uuml;hrt. Platzhalter sind verwendbar.</p>
<p>Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten Dateien den gleichen Eigent&uuml;mer, die gleiche Gruppe und die gleichen Lese- und Schreibberechtigungen wie die Originaldatei, auch wenn die Datei von einem anderen Benutzer umgewandelt wird, der Schreibrechte f&uuml;r die Datei hat (zum Beispiel der Systemadministrator). Die Umwandlung wird abgebrochen, wenn es nicht m&ouml;glich ist, die originalen Werte beizubehalten. Die &Auml;nderung des Eigent&uuml;mers k&ouml;nnte zum Beispiel bewirken, dass der urspr&uuml;ngliche Eigent&uuml;mer die Datei nicht mehr lesen kann. Die &Auml;nderung der Gruppe k&ouml;nnte ein Sicherheitsrisiko sein, da die Datei vielleicht f&uuml;r Benutzer lesbar wird, f&uuml;r die sie nicht bestimmt ist. Die Beibehaltung von Eigent&uuml;mer, Gruppe und Schreib- und Leserechten wird nur unter Unix unterst&uuml;tzt.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Stiller Modus, in dem alle Warnungen und sonstige Meldungen unterdr&uuml;ckt werden. Der R&uuml;ckgabewert ist 0, au&szlig;er wenn fehlerhafte Befehlszeilenoptionen angegeben werden.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>entfernt die Markierung der Bytereihenfolge (BOM). Es wird keine BOM in die Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von Unix-Zeilenumbr&uuml;chen. Siehe auch die Option <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>&uuml;berspringt Bin&auml;rdateien (Vorgabe).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>erh&auml;lt die originale UTF-16-Kodierung der Eingabedatei. Die Ausgabedatei wird in der gleichen UTF-16-Kodierung geschrieben (Little-Endian- oder Big-Endian-Bytereihenfolge) wie die Eingabedatei. Dies verhindert die Umwandlung in UTF-8. Eine UTF-16-BOM wird dementsprechend geschrieben. Diese Option kann durch Angabe der Option <code>-ascii</code> deaktiviert werden.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>nimmt an, dass die Eingabedatei das Format UTF-16LE hat.</p>
<p>Wenn die Eingabedatei eine Markierung der Bytereihenfolge enth&auml;lt (BOM), dann hat die BOM Vorrang vor dieser Option.</p>
<p>Durch eine falsche Annahme (die Eingabedatei war nicht in UTF-16LE kodiert) mit erfolgreicher Umwandlung erhalten Sie eine UTF-8-Ausgabedatei mit fehlerhaftem Text. Sie k&ouml;nnen die fehlgeschlagene Umwandlung mit iconv(1) r&uuml;ckg&auml;ngig machen, indem Sie die R&uuml;ckumwandlung von UTF-8 nach UTF-16LE vornehmen. Dadurch gewinnen Sie die Originaldatei zur&uuml;ck.</p>
<p>Die Annahme von UTF-16LE wirkt wie ein <i>Umwandlungsmodus</i>. Beim Wechsel zum vorgegebenen <i>ascii</i>-Modus wird die UTF16LE-Annahme deaktiviert.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>nimmt an, dass die Eingabedatei das Format UTF-16BE hat.</p>
<p>Diese Option ist gleichbedeutend mit <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>zeigt ausf&uuml;hrliche Meldungen an. Zus&auml;tzliche Informationen werden zu den Markierungen der Bytereihenfolge (BOM) und zur Anzahl der umgewandelten Zeilenumbr&uuml;che angezeigt.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>folgt symbolischen Links und wandelt die Zieldateien um.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>ersetzt symbolische Links durch die umgewandelten Dateien (die originalen Zieldateien bleiben unver&auml;ndert).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>erh&auml;lt symbolische Links als solche und l&auml;sst die Ziele unver&auml;ndert (Vorgabe).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>zeigt Versionsinformationen an und beendet das Programm.</p>
</dd>
</dl>
<h1 id="MAC-MODUS">MAC-MODUS</h1>
<p>Im Normalmodus werden Zeilenumbr&uuml;che von DOS nach Unix und umgekehrt umgewandelt. Mac-Zeilenumbr&uuml;che werden nicht ver&auml;ndert.</p>
<p>Im Mac-Modus werden Zeilenumbr&uuml;che von Mac nach Unix und umgekehrt umgewandelt. DOS-Zeilenumbr&uuml;che werden nicht ver&auml;ndert.</p>
<p>Um das Programm im Mac-Modus auszuf&uuml;hren, verwenden Sie die Befehlszeilenoption <code>-c mac</code> oder die Befehle <code>mac2unix</code> oder <code>unix2mac</code>.</p>
<h1 id="UMWANDLUNGSMODI">UMWANDLUNGSMODI</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>Im <code>ascii</code>-Modus werden nur Zeilenumbr&uuml;che umgewandelt. Dies ist der vorgegebene Umwandlungsmodus.</p>
<p>Obwohl der Name dieses Modus auf ASCII hinweist, welches ein 7-bit-Standard ist, bezieht sich der eigentliche Modus auf 8 Bit. Verwenden Sie diesen Modus immer dann, wenn Sie Unicode-Dateien in UTF-8-Kodierung umwandeln.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das 7-Bit-Bitmuster umgewandelt.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den ISO-Zeichensatz ISO-8859-1 (Latin-1) in Unix umgewandelt. DOS-Zeichen ohne &Auml;quivalent in ISO-8859-1, f&uuml;r die die Umwandlung nicht m&ouml;glich ist, werden durch einen Punkt ersetzt. Gleiches gilt f&uuml;r ISO-8859-1-Zeichen ohne DOS-Gegenst&uuml;ck.</p>
<p>Wenn nur die Option <code>-iso</code> angegeben ist, versucht dos2unix die aktive Codepage selbst zu ermitteln. Sollte dies nicht m&ouml;glich sein, wird die Standard-Codepage CP437 verwendet, welche haupts&auml;chlich in den USA eingesetzt wird. Um eine bestimmte Codepage zu erzwingen, verwenden Sie die Optionen <code>-437</code> (US), <code>-850</code> (Westeurop&auml;isch), <code>-860</code> (Portugiesisch), <code>-863</code> (Kanadisches Franz&ouml;sisch) oder <code>-865</code> (Skandinavisch). Die Windows-Codepage CP1252 (Westeurop&auml;isch) wird durch die Option <code>-1252</code> unterst&uuml;tzt.</p>
<p>Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In UTF-8 kodierte Dateien werden dadurch besch&auml;digt.</p>
<p>Einige Beispiele:</p>
<p>Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin-1:</p>
<pre><code> dos2unix -iso -n in.txt ausgabe.txt</code></pre>
<p>Umwandlung von DOS CP850 nach Unix Latin-1:</p>
<pre><code> dos2unix -850 -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Windows CP1252 nach Unix Latin-1:</p>
<pre><code> dos2unix -1252 -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Windows CP1252 nach Unix UTF-8 (Unicode):</p>
<pre><code> iconv -f CP1252 -t UTF-8 eingabe.txt | dos2unix &gt; ausgabe.txt</code></pre>
<p>Umwandlung von Unix Latin-1 in die vorgegebene DOS-Codepage:</p>
<pre><code> unix2dos -iso -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Unix Latin-1 nach DOS CP850:</p>
<pre><code> unix2dos -850 -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Unix Latin-1 nach Windows CP1252:</p>
<pre><code> unix2dos -1252 -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Unix UTF-8 (Unicode) nach Windows CP1252:</p>
<pre><code> unix2dos &lt; eingabe.txt | iconv -f UTF-8 -t CP1252 &gt; ausgabe.txt</code></pre>
<p>Siehe auch <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> und <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Zeichenkodierungen">Zeichenkodierungen</h2>
<p>Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux sind Unicode-Dateien typischerweise in UTF-8 kodiert. Unter Windows k&ouml;nnen Textdateien in UTF-8, UTF-16 oder UTF-16 in Big-Endian-Bytereihenfolge kodiert sein, liegen aber meist im Format UTF-16 vor.</p>
<h2 id="Umwandlung">Umwandlung</h2>
<p>Unicode-Textdateien k&ouml;nnen DOS-, Unix- oder Mac-Zeilenumbr&uuml;che enthalten, so wie regul&auml;re Textdateien.</p>
<p>Alle Versionen von dos2unix und unix2dos k&ouml;nnen UTF-8-kodierte Dateien umwandeln, weil UTF-8 im Hinblick auf Abw&auml;rtskompatiblit&auml;t mit ASCII entwickelt wurde.</p>
<p>Dos2unix und unix2dos mit Unterst&uuml;tzung f&uuml;r UTF-16 k&ouml;nnen in UTF-16 kodierte Dateien in Little-Endian- und Big-Endian-Bytereihenfolge lesen. Um festzustellen, ob dos2unix mit UTF-16-Unterst&uuml;tzung kompiliert wurde, geben Sie <code>dos2unix -V</code> ein.</p>
<p>Unter Unix/Linux werden UTF-16 kodierte Dateien standardm&auml;&szlig;ig in die Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl locale(1) k&ouml;nnen Sie herausfinden, wie die Zeichenkodierung der Locale eingestellt ist. Wenn eine Umwandlung nicht m&ouml;glich ist, verursacht dies einen Umwandlungsfehler, wodurch die Datei &uuml;bersprungen wird.</p>
<p>Unter Windows werden UTF-16-Dateien standardm&auml;&szlig;ig in UTF-8 umgewandelt. In UTF-8 formatierte Textdateien werden von Windows und Unix/Linux gleicherma&szlig;en unterst&uuml;tzt.</p>
<p>Die Kodierungen UTF-16 und UTF-8 sind vollst&auml;ndig kompatibel, daher wird bei der Umwandlung keinerlei Text verlorengehen. Sollte bei der Umwandlung von UTF-16 in UTF-8 ein Problem auftreten, beispielsweise wenn die UTF-16-kodierte Eingabedatei einen Fehler enth&auml;lt, dann wird diese Datei &uuml;bersprungen.</p>
<p>Wenn die Option <code>-u</code> verwendet wird, wird die Ausgabedatei in der gleichen UTF-16-Kodierung wie die Eingabedatei geschrieben. Die Option <code>-u</code> verhindert die Umwandlung in UTF-8.</p>
<p>Dos2unix und unix2dos bieten keine Option zur Umwandlung von UTF-8-Dateien in UTF-16.</p>
<p>Umwandlungen im ISO- und 7bit-Modus funktionieren mit UTF-16-Dateien nicht.</p>
<h2 id="Markierung-der-Bytereihenfolge">Markierung der Bytereihenfolge</h2>
<p>Unicode-Textdateien unter Windows haben typischerweise eine Markierung der Bytereihenfolge (BOM), da viele Windows-Programme (zum Beispiel Notepad) solche BOMs standardm&auml;&szlig;ig hinzuf&uuml;gen. Weitere Informationen hierzu finden Sie auf <a href="http://de.wikipedia.org/wiki/Byte-Reihenfolge">http://de.wikipedia.org/wiki/Byte-Reihenfolge</a>.</p>
<p>Unter Unix haben Textdateien &uuml;blicherweise keine BOM. Es wird stattdessen angenommen, dass Textdateien in der Zeichenkodierung entsprechend der Spracheinstellung vorliegen.</p>
<p>Dos2unix kann nur dann erkennen, ob eine Datei UTF-16-kodiert ist, wenn die Datei eine BOM enth&auml;lt. Ist dies nicht der Fall, nimmt dos2unix an, dass es sich um eine Bin&auml;rdatei handelt.</p>
<p>Verwenden Sie die Optionen <code>-ul</code> oder <code>-ub</code>, um eine UTF-16-Datei ohne BOM umzuwandeln.</p>
<p>Dos2unix schreibt in der Voreinstellung keine BOM in die Ausgabedatei. Mit der Option <code>-b</code> schreibt Dos2unix eine BOM, wenn die Eingabedatei ebenfalls eine BOM hat.</p>
<p>Unix2dos schreibt in der Voreinstellung eine BOM in die Ausgabedatei, wenn die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden Sie die Option <code>-r</code>, um die BOM zu entfernen.</p>
<p>Dos2unix und unix2dos schreiben immer eine BOM, wenn die Option <code>-m</code> angegeben ist.</p>
<h2 id="Unicode-Beispiele">Unicode-Beispiele</h2>
<p>Umwandlung von Windows UTF-16 (mit BOM) nach Unix UTF-8:</p>
<pre><code> dos2unix -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Windows UTF-16LE (ohne BOM) nach Unix UTF-8:</p>
<pre><code> dos2unix -ul -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Unix UTF-8 nach Windows UTF-8 mit BOM:</p>
<pre><code> unix2dos -m -n eingabe.txt ausgabe.txt</code></pre>
<p>Umwandlung von Unix UTF-8 nach Windows UTF-16:</p>
<pre><code> unix2dos &lt; eingabe.txt | iconv -f UTF-8 -t UTF-16 &gt; ausgabe.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 ist ein Standard der chinesischen Regierung. Eine Teilmenge des in GB18030 definierten Standards ist offiziell f&uuml;r alle in China verkauften Softwareprodukte vorgeschrieben. Siehe auch <a href="http://de.wikipedia.org/wiki/GB_18030">http://de.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 ist vollst&auml;ndig zu Unicode kompatibel und kann als Unicode-Umwandlungsformat betrahctet werden. Wie auch UTF-8 ist GB18030 kompatibel zu ASCII. Ebenfalls kompatibel ist es zur Codepage 936 von Windows, auch als GBK bekannt.</p>
<p>Unter Unix/Linux werden UTF-16-Dateien in GB18030 umgewandelt, wenn die Einstellung der Locale auf GB18030 gesetzt ist. Beachten Sie, dass dies nur funktioniert, wenn der Ort auf &raquo;China&laquo; gesetzt ist. Zum Beispiel wird in einer Locale-Einstellung <code>en_GB.GB18030</code> (Britisches Englisch) die Umwandlung von UTF-16 in GB18030 nicht m&ouml;glich sein, aber in der chinesischen Einstellung <code>zh_CN.GB18030</code> dagegen funktionieren.</p>
<p>Unter Windows ben&ouml;tigen Sie die Option <code>-gb</code>, um UTF-16-Dateien in GB18030 umwandeln zu k&ouml;nnen.</p>
<p>In GB 18030 kodierte Dateien haben wie Unicode-Dateien eine Markierung der Bytereihenfolge (BOM).</p>
<h1 id="BEISPIELE">BEISPIELE</h1>
<p>Aus der Standardeingabe lesen und in die Standardausgabe schreiben:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>a.txt im ascii-Modus umwandeln und ersetzen:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit-Modus umwandeln und ersetzen:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>a.txt aus dem Mac- in das Unix-Format umwandeln:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>a.txt aus dem Unix- in das Mac-Format umwandeln:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>a.txt unter Beibehaltung des urspr&uuml;nglichen Zeitstempels umwandeln:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>a.txt umwandeln und das Ergebnis nach e.txt schreiben:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den gleichen Zeitstempel erh&auml;lt wie a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach e.txt schreiben:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das Ergebnis nach f.txt schreiben:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="REKURSIVE-UMWANDLUNG">REKURSIVE UMWANDLUNG</h1>
<p>Verwenden Sie dos2unix zusammen mit den Befehlen find(1) und xargs(1), um Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um beispielsweise alle *.txt-Dateien im aktuellen Verzeichnis und dessen Unterverzeichnissen umzuwandeln, geben Sie Folgendes ein:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="LOKALISIERUNG">LOKALISIERUNG</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>Die prim&auml;re Sprache wird durch die Umgebungsvariable LANG festgelegt. Diese Variable besteht aus mehreren Teilen: Der erste Teil besteht aus zwei Kleinbuchstaben, die den Sprachcode angeben. Der zweite Teil ist optional und bezeichnet den L&auml;ndercode in Gro&szlig;buchstaben, vom davor stehenden Sprachcode durch einen Unterstrich getrennt. Der dritte Teil ist ebenfalls optional und gibt die Zeichenkodierung an, vom L&auml;ndercode durch einen Punkt getrennt. Einige Beispiele f&uuml;r Standard-POSIX-Shells:</p>
<pre><code> export LANG=de Deutsch
export LANG=de_DE Deutsch, Deutschland
export LANG=de_AT Deutsch, &Ouml;sterreich
export LANG=es_ES Spanisch, Spanien
export LANG=es_MX Spanisch, Mexiko
export LANG=en_US.iso88591 Englisch, USA, Latin-1-Zeichenkodierung
export LANG=en_GB.UTF-8 Englisch, GB, UTF-8-Zeichenkodierung</code></pre>
<p>Eine vollst&auml;ndige Liste der Sprachen und L&auml;ndercodes finden Sie im Gettext-Handbuch: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>Auf Unix-Systemen erhalten Sie mit dem Befehl locale(1) spezifische Informationen zu den Spracheinstellungen.</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>Mit der Umgebungsvariable LANGUAGE k&ouml;nnen Sie eine Priorit&auml;tenliste f&uuml;r Sprachen &uuml;bergeben, die Sie durch Doppelpunkte voneinander trennen. Dos2unix gibt LANGUAGE vor LANG den Vorzug, zum Beispiel bei Deutsch vor Niederl&auml;ndisch: <code>LANGUAGE=de:nl</code>. Sie m&uuml;ssen zun&auml;chst die Lokalisierung aktivieren, indem Sie die Variable LANG (oder LC_ALL) auf einen anderen Wert als &raquo;C&laquo; setzen, bevor Sie die Liste der Sprachpriorit&auml;ten mit der Variable LANGUAGE nutzen k&ouml;nnen. Weitere Informationen finden Sie im Gettext-Handbuch: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>Falls Sie eine Sprache ausw&auml;hlen, die nicht verf&uuml;gbar ist, erhalten Sie die Standardmeldungen in englischer Sprache.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Durch die Umgebungsvariable DOS2UNIX_LOCALEDIR wird LOCALEDIR w&auml;hrend der Kompilierung &uuml;bergangen. LOCALEDIR wird verwendet, um Sprachdateien zu finden. Der GNU-Standardwert ist <code>/usr/local/share/locale</code>. Die Option <b>--version</b> zeigt das verwendete LOCALEDIR an.</p>
<p>Beispiel (POSIX-Shell):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="RCKGABEWERT">R&Uuml;CKGABEWERT</h1>
<p>Bei Erfolg wird 0 zur&uuml;ckgegeben. Bei aufgetretenen Systemfehlern wird der letzte Systemfehler zur&uuml;ckgegeben. F&uuml;r alle anderen Fehler wird 1 zur&uuml;ckgegeben.</p>
<p>Der R&uuml;ckgabewert ist im stillen Modus stets 0, au&szlig;er wenn fehlerhafte Befehlszeilenoptionen verwendet werden.</p>
<h1 id="STANDARDS">STANDARDS</h1>
<p><a href="http://de.wikipedia.org/wiki/Textdatei">http://de.wikipedia.org/wiki/Textdatei</a></p>
<p><a href="http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf">http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf</a></p>
<p><a href="http://de.wikipedia.org/wiki/Zeilenumbruch">http://de.wikipedia.org/wiki/Zeilenumbruch</a></p>
<p><a href="http://en.wikipedia.org/wiki/Unicode">http://en.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTOREN">AUTOREN</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (Mac2unix-Modus) - &lt;wuebben@kde.org&gt;, Christian Wurll (Extra Zeilenumbruch) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (Betreuer)</p>
<p>Projektseite: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>SourceForge-Seite: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="SIEHE-AUCH">SIEHE AUCH</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,634 +0,0 @@
BEZEICHNUNG
dos2unix - Formatumwandlung für Textdateien von DOS/Mac nach Unix und
umgekehrt
ÜBERSICHT
dos2unix [Optionen] [DATEI …] [-n EINGABEDATEI AUSGABEDATEI …]
unix2dos [Optionen] [DATEI …] [-n EINGABEDATEI AUSGABEDATEI …]
BESCHREIBUNG
Das Paket Dos2unix enthält die Werkzeuge "dos2unix" und "unix2dos" zum
Umwandeln einfacher Textdateien aus dem DOS- oder Mac-Format in das
Unix-Format und umgekehrt.
In Textdateien unter DOS/Windows sind Zeilenumbrüche, auch als neue
Zeile (NL) bekannt, eine Kombination aus zwei Zeichen: einem
Wagenrücklauf (Carriage Return, CR) gefolgt von einem Zeilenvorschub
(Line Feed, LF). In Unix-Textdateien bestehen Zeilenumbrüche nur aus
einem Zeichen, dem Zeilenvorschub (LF). In Mac-Textdateien aus der Zeit
vor MacOSX bestand ein Zeilenumbruch aus einem einzelnen CR-Zeichen.
Heute verwendet Mac OS Zeilenumbrüche im Unix-Stil (LF).
Neben Zeilenumbrüchen kann Dos2unix auch die Zeichenkodierung von
Dateien umwandeln. Einige DOS-Codepages können in Unix Latin-1
umgewandelt werden, und Windows-Unicode-Dateien (UTF-16) können in
Unix-Unicode-Dateien (UTF-8) umgewandelt werden.
Binärdateien werden automatisch übersprungen, sofern die Umwandlung
nicht erzwungen wird.
Nicht-reguläre Dateien, wie Verzeichnisse und FIFOS (Weiterleitungen)
werden automatisch übersprungen.
Symbolische Links und deren Ziele werden per Vorgabe unverändert
belassen. Symbolische Links können optional ersetzt werden, oder die
Ausgabe wird in das Ziel des symbolischen Links geschrieben. Unter
Windows wird das Schreiben in das Ziel eines symbolischen Links nicht
unterstützt.
Dos2unix wurde nach dem Vorbild der dos2unix-Version unter SunOS/Solaris
entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese
Version ersetzt per Vorgabe Dateien bei der Umwandlung
(Alte-Datei-Modus), während unter SunOS/Solaris nur die paarweise
Umwandlung (Neue-Datei-Modus) unterstützt wird. Siehe dazu die Optionen
"-o" und "-n".
OPTIONEN
-- nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese
Option, wenn Sie Dateien umwandeln wollen, deren Namen mit einem
Minuszeichen beginnen. Um beispielsweise eine Datei namens »-bla«
umzuwandeln, können Sie folgenden Befehl verwenden:
dos2unix -- -bla
oder im Neue-Datei-Modus:
dos2unix -n -- -bla ausgabe.txt
-ascii
wandelt nur Zeilenumbrüche um. Dies ist der vorgegebene
Umwandlungsmodus.
-iso
wandelt aus dem DOS- in den ISO-8859-1-Zeichensatz um. Weitere
Informationen hierzu finden Sie im Abschnitt UMWANDLUNGSMODI.
-1252
verwendet die Windows-Codepage 1252 (Westeuropäisch).
-437
verwendet die DOS-Codepage 437 (US). Dies ist die vorgegebene
Codepage für die ISO-Umwandlung.
-850
verwendet die DOS-Codepage 850 (Westeuropäisch).
-860
verwendet die DOS-Codepage 860 (Portugiesisch).
-863
verwendet die DOS-Codepage 863 (Kanadisches Französisch).
-865
verwendet die DOS-Codepage 865 (Skandinavisch).
-7 wandelt 8bit-Zeichen in ein 7bit-Bitmuster um.
-b, --keep-bom
erhält die Markierung der Bytereihenfolge (BOM). Wenn die
Eingabedatei eine BOM enthält, wird ebenfalls eine BOM in die
Ausgabedatei geschrieben. Dies ist das Standardverhalten beim
Umwandeln von DOS-Zeilenumbrüchen. Siehe auch die Option "-r".
-c, --convmode UMWANDLUNGSMODUS
legt den Umwandlungsmodus fest. UMWANDLUNGSMODUS kann *ascii*,
*7bit*, *iso* oder *mac* sein, wobei *ascii* die Vorgabe ist.
-f, --force
erzwingt die Umwandlung von Binärdateien.
-gb, --gb18030
wandelt unter Windows UTF-16-Dateien standardmäßig in UTF-8 um,
ungeachtet der Einstellung der Locale. Verwenden Sie diese Option
zum umwandeln von Utf-16-Dateien in GB18030. Diese Option ist nur
unter Windows verfügbar. Siehe auch Abschnitt GB18030.
-h, --help
zeigt eine Hilfe an und beendet das Programm.
-i[SCHALTER], --info[=SCHALTER] DATEI
zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.
Die Ausgabe der Informationen geschieht in der folgenden
Reihenfolge: Anzahl der DOS-Zeilenumbrüche, Anzahl der
Unix-Zeilenumbrüche, Anzahl der Mac-Zeilenumbrüche, Markierung der
Bytereihenfolge, Text- oder Binärformat, Dateiname.
Beispielausgabe:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Optionale zusätzliche Schalter können gesetzt werden, um die Ausgabe
anzupassen. Einer oder mehrere Schalter können hinzugefügt werden.
d gibt die Anzahl der DOS-Zeilenumbrüche aus.
u gibt die Anzahl der Unix-Zeilenumbrüche aus.
m gibt die Anzahl der Mac-Zeilenumbrüche aus.
b gibt die Markierung der Bytereihenfolge aus.
t zeigt an, ob es sich um eine Text- oder eine Binärdatei handelt.
c gibt nur die Dateien aus, die umgewandelt werden würden.
Mit dem Schalter "c" gibt dos2unix nur die Dateien aus, die
DOS-Zeilenumbrüche enthalten, unix2dos nur die Dateien mit
Unix-Zeilenumbrüchen.
Beispiele:
Informationen zu allen *.txt-Dateien anzeigen:
dos2unix -i *.txt
Nur die Anzahl der DOS-Zeilenumbrüche und Unix-Zeilenumbrüche
anzeigen:
dos2unix -idu *.txt
Nur die Markierung der Bytereihenfolge anzeigen:
dos2unix --info=b *.txt
Die Dateien auflisten, die DOS-Zeilenumbrüche enthalten:
dos2unix -ic *.txt
Die Dateien auflisten, die Unix-Zeilenumbrüche enthalten:
unix2dos -ic *.txt
-k, --keepdate
übernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.
-L, --license
zeigt die Lizenz des Programms an.
-l, --newline
fügt eine zusätzliche neue Zeile hinzu.
dos2unix: Nur DOS-Zeilenumbrüche werden in Unix-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Mac-Zeilenumbrüche in
Unix-Zeilenumbrüche umgewandelt.
unix2dos: Nur Unix-Zeilenumbrüche werden in DOS-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Unix-Zeilenumbrüche in
Mac-Zeilenumbrüche umgewandelt.
-m, --add-bom
schreibt eine Markierung der Bytereihenfolge (BOM) in die
Ausgabedatei. In der Voreinstellung wird eine UTF-8-BOM geschrieben.
Wenn die Eingabedatei in UTF-16 kodiert ist und die Option "-u"
verwendet wird, wird eine UTF-16-BOM geschrieben.
Verwenden Sie diese Option niemals, wenn die Kodierung der
Ausgabedatei weder UTF-8 noch UTF-16 ist. Weitere Informationen
finden Sie im Abschnitt UNICODE.
-n, --newfile EINGABEDATEI AUSGABEDATEI …
Neue-Datei-Modus. Die EINGABEDATEI wird umgewandelt und in die
AUSGABEDATEI geschrieben. Die Dateinamen müssen paarweise angegeben
werden. Platzhalter sollten *nicht* verwendet werden, sonst werden
Sie Ihre Dateien *verlieren*.
Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird
Besitzer der umgewandelten Datei. Die Lese- und Schreibrechte werden
aus den Zugriffsrechten der Originaldatei minus der umask(1) der
Person ermittelt, die die Umwandlung ausgeführt hat.
-o, --oldfile DATEI …
Alte-Datei-Modus. Die DATEI wird umgewandelt und durch die
Ausgabedatei überschrieben. Per Vorgabe werden Umwandlungen in
diesem Modus ausgeführt. Platzhalter sind verwendbar.
Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten
Dateien den gleichen Eigentümer, die gleiche Gruppe und die gleichen
Lese- und Schreibberechtigungen wie die Originaldatei, auch wenn die
Datei von einem anderen Benutzer umgewandelt wird, der Schreibrechte
für die Datei hat (zum Beispiel der Systemadministrator). Die
Umwandlung wird abgebrochen, wenn es nicht möglich ist, die
originalen Werte beizubehalten. Die Änderung des Eigentümers könnte
zum Beispiel bewirken, dass der ursprüngliche Eigentümer die Datei
nicht mehr lesen kann. Die Änderung der Gruppe könnte ein
Sicherheitsrisiko sein, da die Datei vielleicht für Benutzer lesbar
wird, für die sie nicht bestimmt ist. Die Beibehaltung von
Eigentümer, Gruppe und Schreib- und Leserechten wird nur unter Unix
unterstützt.
-q, --quiet
Stiller Modus, in dem alle Warnungen und sonstige Meldungen
unterdrückt werden. Der Rückgabewert ist 0, außer wenn fehlerhafte
Befehlszeilenoptionen angegeben werden.
-r, --remove-bom
entfernt die Markierung der Bytereihenfolge (BOM). Es wird keine BOM
in die Ausgabedatei geschrieben. Dies ist das Standardverhalten beim
Umwandeln von Unix-Zeilenumbrüchen. Siehe auch die Option "-b".
-s, --safe
überspringt Binärdateien (Vorgabe).
-u, --keep-utf16
erhält die originale UTF-16-Kodierung der Eingabedatei. Die
Ausgabedatei wird in der gleichen UTF-16-Kodierung geschrieben
(Little-Endian- oder Big-Endian-Bytereihenfolge) wie die
Eingabedatei. Dies verhindert die Umwandlung in UTF-8. Eine
UTF-16-BOM wird dementsprechend geschrieben. Diese Option kann durch
Angabe der Option "-ascii" deaktiviert werden.
-ul, --assume-utf16le
nimmt an, dass die Eingabedatei das Format UTF-16LE hat.
Wenn die Eingabedatei eine Markierung der Bytereihenfolge enthält
(BOM), dann hat die BOM Vorrang vor dieser Option.
Durch eine falsche Annahme (die Eingabedatei war nicht in UTF-16LE
kodiert) mit erfolgreicher Umwandlung erhalten Sie eine
UTF-8-Ausgabedatei mit fehlerhaftem Text. Sie können die
fehlgeschlagene Umwandlung mit iconv(1) rückgängig machen, indem Sie
die Rückumwandlung von UTF-8 nach UTF-16LE vornehmen. Dadurch
gewinnen Sie die Originaldatei zurück.
Die Annahme von UTF-16LE wirkt wie ein *Umwandlungsmodus*. Beim
Wechsel zum vorgegebenen *ascii*-Modus wird die UTF16LE-Annahme
deaktiviert.
-ub, --assume-utf16be
nimmt an, dass die Eingabedatei das Format UTF-16BE hat.
Diese Option ist gleichbedeutend mit "-ul".
-v, --verbose
zeigt ausführliche Meldungen an. Zusätzliche Informationen werden zu
den Markierungen der Bytereihenfolge (BOM) und zur Anzahl der
umgewandelten Zeilenumbrüche angezeigt.
-F, --follow-symlink
folgt symbolischen Links und wandelt die Zieldateien um.
-R, --replace-symlink
ersetzt symbolische Links durch die umgewandelten Dateien (die
originalen Zieldateien bleiben unverändert).
-S, --skip-symlink
erhält symbolische Links als solche und lässt die Ziele unverändert
(Vorgabe).
-V, --version
zeigt Versionsinformationen an und beendet das Programm.
MAC-MODUS
Im Normalmodus werden Zeilenumbrüche von DOS nach Unix und umgekehrt
umgewandelt. Mac-Zeilenumbrüche werden nicht verändert.
Im Mac-Modus werden Zeilenumbrüche von Mac nach Unix und umgekehrt
umgewandelt. DOS-Zeilenumbrüche werden nicht verändert.
Um das Programm im Mac-Modus auszuführen, verwenden Sie die
Befehlszeilenoption "-c mac" oder die Befehle "mac2unix" oder
"unix2mac".
UMWANDLUNGSMODI
ascii
Im "ascii"-Modus werden nur Zeilenumbrüche umgewandelt. Dies ist der
vorgegebene Umwandlungsmodus.
Obwohl der Name dieses Modus auf ASCII hinweist, welches ein
7-bit-Standard ist, bezieht sich der eigentliche Modus auf 8 Bit.
Verwenden Sie diesen Modus immer dann, wenn Sie Unicode-Dateien in
UTF-8-Kodierung umwandeln.
7bit
In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das
7-Bit-Bitmuster umgewandelt.
iso Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den
ISO-Zeichensatz ISO-8859-1 (Latin-1) in Unix umgewandelt.
DOS-Zeichen ohne Äquivalent in ISO-8859-1, für die die Umwandlung
nicht möglich ist, werden durch einen Punkt ersetzt. Gleiches gilt
für ISO-8859-1-Zeichen ohne DOS-Gegenstück.
Wenn nur die Option "-iso" angegeben ist, versucht dos2unix die
aktive Codepage selbst zu ermitteln. Sollte dies nicht möglich sein,
wird die Standard-Codepage CP437 verwendet, welche hauptsächlich in
den USA eingesetzt wird. Um eine bestimmte Codepage zu erzwingen,
verwenden Sie die Optionen -437 (US), -850 (Westeuropäisch), -860
(Portugiesisch), -863 (Kanadisches Französisch) oder -865
(Skandinavisch). Die Windows-Codepage CP1252 (Westeuropäisch) wird
durch die Option -1252 unterstützt.
Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In
UTF-8 kodierte Dateien werden dadurch beschädigt.
Einige Beispiele:
Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin-1:
dos2unix -iso -n in.txt ausgabe.txt
Umwandlung von DOS CP850 nach Unix Latin-1:
dos2unix -850 -n eingabe.txt ausgabe.txt
Umwandlung von Windows CP1252 nach Unix Latin-1:
dos2unix -1252 -n eingabe.txt ausgabe.txt
Umwandlung von Windows CP1252 nach Unix UTF-8 (Unicode):
iconv -f CP1252 -t UTF-8 eingabe.txt | dos2unix > ausgabe.txt
Umwandlung von Unix Latin-1 in die vorgegebene DOS-Codepage:
unix2dos -iso -n eingabe.txt ausgabe.txt
Umwandlung von Unix Latin-1 nach DOS CP850:
unix2dos -850 -n eingabe.txt ausgabe.txt
Umwandlung von Unix Latin-1 nach Windows CP1252:
unix2dos -1252 -n eingabe.txt ausgabe.txt
Umwandlung von Unix UTF-8 (Unicode) nach Windows CP1252:
unix2dos < eingabe.txt | iconv -f UTF-8 -t CP1252 > ausgabe.txt
Siehe auch <http://czyborra.com/charsets/codepages.html> und
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Zeichenkodierungen
Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux
sind Unicode-Dateien typischerweise in UTF-8 kodiert. Unter Windows
können Textdateien in UTF-8, UTF-16 oder UTF-16 in
Big-Endian-Bytereihenfolge kodiert sein, liegen aber meist im Format
UTF-16 vor.
Umwandlung
Unicode-Textdateien können DOS-, Unix- oder Mac-Zeilenumbrüche
enthalten, so wie reguläre Textdateien.
Alle Versionen von dos2unix und unix2dos können UTF-8-kodierte Dateien
umwandeln, weil UTF-8 im Hinblick auf Abwärtskompatiblität mit ASCII
entwickelt wurde.
Dos2unix und unix2dos mit Unterstützung für UTF-16 können in UTF-16
kodierte Dateien in Little-Endian- und Big-Endian-Bytereihenfolge lesen.
Um festzustellen, ob dos2unix mit UTF-16-Unterstützung kompiliert wurde,
geben Sie "dos2unix -V" ein.
Unter Unix/Linux werden UTF-16 kodierte Dateien standardmäßig in die
Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl
locale(1) können Sie herausfinden, wie die Zeichenkodierung der Locale
eingestellt ist. Wenn eine Umwandlung nicht möglich ist, verursacht dies
einen Umwandlungsfehler, wodurch die Datei übersprungen wird.
Unter Windows werden UTF-16-Dateien standardmäßig in UTF-8 umgewandelt.
In UTF-8 formatierte Textdateien werden von Windows und Unix/Linux
gleichermaßen unterstützt.
Die Kodierungen UTF-16 und UTF-8 sind vollständig kompatibel, daher wird
bei der Umwandlung keinerlei Text verlorengehen. Sollte bei der
Umwandlung von UTF-16 in UTF-8 ein Problem auftreten, beispielsweise
wenn die UTF-16-kodierte Eingabedatei einen Fehler enthält, dann wird
diese Datei übersprungen.
Wenn die Option "-u" verwendet wird, wird die Ausgabedatei in der
gleichen UTF-16-Kodierung wie die Eingabedatei geschrieben. Die Option
"-u" verhindert die Umwandlung in UTF-8.
Dos2unix und unix2dos bieten keine Option zur Umwandlung von
UTF-8-Dateien in UTF-16.
Umwandlungen im ISO- und 7bit-Modus funktionieren mit UTF-16-Dateien
nicht.
Markierung der Bytereihenfolge
Unicode-Textdateien unter Windows haben typischerweise eine Markierung
der Bytereihenfolge (BOM), da viele Windows-Programme (zum Beispiel
Notepad) solche BOMs standardmäßig hinzufügen. Weitere Informationen
hierzu finden Sie auf <http://de.wikipedia.org/wiki/Byte-Reihenfolge>.
Unter Unix haben Textdateien üblicherweise keine BOM. Es wird
stattdessen angenommen, dass Textdateien in der Zeichenkodierung
entsprechend der Spracheinstellung vorliegen.
Dos2unix kann nur dann erkennen, ob eine Datei UTF-16-kodiert ist, wenn
die Datei eine BOM enthält. Ist dies nicht der Fall, nimmt dos2unix an,
dass es sich um eine Binärdatei handelt.
Verwenden Sie die Optionen "-ul" oder "-ub", um eine UTF-16-Datei ohne
BOM umzuwandeln.
Dos2unix schreibt in der Voreinstellung keine BOM in die Ausgabedatei.
Mit der Option "-b" schreibt Dos2unix eine BOM, wenn die Eingabedatei
ebenfalls eine BOM hat.
Unix2dos schreibt in der Voreinstellung eine BOM in die Ausgabedatei,
wenn die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden
Sie die Option "-r", um die BOM zu entfernen.
Dos2unix und unix2dos schreiben immer eine BOM, wenn die Option "-m"
angegeben ist.
Unicode-Beispiele
Umwandlung von Windows UTF-16 (mit BOM) nach Unix UTF-8:
dos2unix -n eingabe.txt ausgabe.txt
Umwandlung von Windows UTF-16LE (ohne BOM) nach Unix UTF-8:
dos2unix -ul -n eingabe.txt ausgabe.txt
Umwandlung von Unix UTF-8 nach Windows UTF-8 mit BOM:
unix2dos -m -n eingabe.txt ausgabe.txt
Umwandlung von Unix UTF-8 nach Windows UTF-16:
unix2dos < eingabe.txt | iconv -f UTF-8 -t UTF-16 > ausgabe.txt
GB18030
GB18030 ist ein Standard der chinesischen Regierung. Eine Teilmenge des
in GB18030 definierten Standards ist offiziell für alle in China
verkauften Softwareprodukte vorgeschrieben. Siehe auch
<http://de.wikipedia.org/wiki/GB_18030>.
GB18030 ist vollständig zu Unicode kompatibel und kann als
Unicode-Umwandlungsformat betrahctet werden. Wie auch UTF-8 ist GB18030
kompatibel zu ASCII. Ebenfalls kompatibel ist es zur Codepage 936 von
Windows, auch als GBK bekannt.
Unter Unix/Linux werden UTF-16-Dateien in GB18030 umgewandelt, wenn die
Einstellung der Locale auf GB18030 gesetzt ist. Beachten Sie, dass dies
nur funktioniert, wenn der Ort auf »China« gesetzt ist. Zum Beispiel
wird in einer Locale-Einstellung "en_GB.GB18030" (Britisches Englisch)
die Umwandlung von UTF-16 in GB18030 nicht möglich sein, aber in der
chinesischen Einstellung "zh_CN.GB18030" dagegen funktionieren.
Unter Windows benötigen Sie die Option "-gb", um UTF-16-Dateien in
GB18030 umwandeln zu können.
In GB 18030 kodierte Dateien haben wie Unicode-Dateien eine Markierung
der Bytereihenfolge (BOM).
BEISPIELE
Aus der Standardeingabe lesen und in die Standardausgabe schreiben:
dos2unix
dos2unix -l -c mac
a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
a.txt im ascii-Modus umwandeln und ersetzen:
dos2unix a.txt
a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit-Modus
umwandeln und ersetzen:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
a.txt aus dem Mac- in das Unix-Format umwandeln:
dos2unix -c mac a.txt
mac2unix a.txt
a.txt aus dem Unix- in das Mac-Format umwandeln:
unix2dos -c mac a.txt
unix2mac a.txt
a.txt unter Beibehaltung des ursprünglichen Zeitstempels umwandeln:
dos2unix -k a.txt
dos2unix -k -o a.txt
a.txt umwandeln und das Ergebnis nach e.txt schreiben:
dos2unix -n a.txt e.txt
a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den
gleichen Zeitstempel erhält wie a.txt:
dos2unix -k -n a.txt e.txt
a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach
e.txt schreiben:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln
und ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das
Ergebnis nach f.txt schreiben:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
REKURSIVE UMWANDLUNG
Verwenden Sie dos2unix zusammen mit den Befehlen find(1) und xargs(1),
um Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um
beispielsweise alle *.txt-Dateien im aktuellen Verzeichnis und dessen
Unterverzeichnissen umzuwandeln, geben Sie Folgendes ein:
find . -name *.txt |xargs dos2unix
LOKALISIERUNG
LANG
Die primäre Sprache wird durch die Umgebungsvariable LANG
festgelegt. Diese Variable besteht aus mehreren Teilen: Der erste
Teil besteht aus zwei Kleinbuchstaben, die den Sprachcode angeben.
Der zweite Teil ist optional und bezeichnet den Ländercode in
Großbuchstaben, vom davor stehenden Sprachcode durch einen
Unterstrich getrennt. Der dritte Teil ist ebenfalls optional und
gibt die Zeichenkodierung an, vom Ländercode durch einen Punkt
getrennt. Einige Beispiele für Standard-POSIX-Shells:
export LANG=de Deutsch
export LANG=de_DE Deutsch, Deutschland
export LANG=de_AT Deutsch, Österreich
export LANG=es_ES Spanisch, Spanien
export LANG=es_MX Spanisch, Mexiko
export LANG=en_US.iso88591 Englisch, USA, Latin-1-Zeichenkodierung
export LANG=en_GB.UTF-8 Englisch, GB, UTF-8-Zeichenkodierung
Eine vollständige Liste der Sprachen und Ländercodes finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
Auf Unix-Systemen erhalten Sie mit dem Befehl locale(1) spezifische
Informationen zu den Spracheinstellungen.
LANGUAGE
Mit der Umgebungsvariable LANGUAGE können Sie eine Prioritätenliste
für Sprachen übergeben, die Sie durch Doppelpunkte voneinander
trennen. Dos2unix gibt LANGUAGE vor LANG den Vorzug, zum Beispiel
bei Deutsch vor Niederländisch: "LANGUAGE=de:nl". Sie müssen
zunächst die Lokalisierung aktivieren, indem Sie die Variable LANG
(oder LC_ALL) auf einen anderen Wert als »C« setzen, bevor Sie die
Liste der Sprachprioritäten mit der Variable LANGUAGE nutzen können.
Weitere Informationen finden Sie im Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Falls Sie eine Sprache auswählen, die nicht verfügbar ist, erhalten
Sie die Standardmeldungen in englischer Sprache.
DOS2UNIX_LOCALEDIR
Durch die Umgebungsvariable DOS2UNIX_LOCALEDIR wird LOCALEDIR
während der Kompilierung übergangen. LOCALEDIR wird verwendet, um
Sprachdateien zu finden. Der GNU-Standardwert ist
"/usr/local/share/locale". Die Option --version zeigt das verwendete
LOCALEDIR an.
Beispiel (POSIX-Shell):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
RÜCKGABEWERT
Bei Erfolg wird 0 zurückgegeben. Bei aufgetretenen Systemfehlern wird
der letzte Systemfehler zurückgegeben. Für alle anderen Fehler wird 1
zurückgegeben.
Der Rückgabewert ist im stillen Modus stets 0, außer wenn fehlerhafte
Befehlszeilenoptionen verwendet werden.
STANDARDS
<http://de.wikipedia.org/wiki/Textdatei>
<http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf>
<http://de.wikipedia.org/wiki/Zeilenumbruch>
<http://en.wikipedia.org/wiki/Unicode>
AUTOREN
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(Mac2unix-Modus) - <wuebben@kde.org>, Christian Wurll (Extra
Zeilenumbruch) - <wurll@ira.uka.de>, Erwin Waterlander -
<waterlan@xs4all.nl> (Betreuer)
Projektseite: <http://waterlan.home.xs4all.nl/dos2unix.html>
SourceForge-Seite: <http://sourceforge.net/projects/dos2unix/>
SIEHE AUCH
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - DOS/MAC to UNIX and vice versa text file format converter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#OPTIONS">OPTIONS</a></li>
<li><a href="#MAC-MODE">MAC MODE</a></li>
<li><a href="#CONVERSION-MODES">CONVERSION MODES</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Encodings">Encodings</a></li>
<li><a href="#Conversion">Conversion</a></li>
<li><a href="#Byte-Order-Mark">Byte Order Mark</a></li>
<li><a href="#Unicode-examples">Unicode examples</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#EXAMPLES">EXAMPLES</a></li>
<li><a href="#RECURSIVE-CONVERSION">RECURSIVE CONVERSION</a></li>
<li><a href="#LOCALIZATION">LOCALIZATION</a></li>
<li><a href="#RETURN-VALUE">RETURN VALUE</a></li>
<li><a href="#STANDARDS">STANDARDS</a></li>
<li><a href="#AUTHORS">AUTHORS</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>dos2unix - DOS/Mac to Unix and vice versa text file format converter</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> dos2unix [options] [FILE ...] [-n INFILE OUTFILE ...]
unix2dos [options] [FILE ...] [-n INFILE OUTFILE ...]</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>The Dos2unix package includes utilities <code>dos2unix</code> and <code>unix2dos</code> to convert plain text files in DOS or Mac format to Unix format and vice versa.</p>
<p>In DOS/Windows text files a line break, also known as newline, is a combination of two characters: a Carriage Return (CR) followed by a Line Feed (LF). In Unix text files a line break is a single character: the Line Feed (LF). In Mac text files, prior to Mac OS X, a line break was single Carriage Return (CR) character. Nowadays Mac OS uses Unix style (LF) line breaks.</p>
<p>Besides line breaks Dos2unix can also convert the encoding of files. A few DOS code pages can be converted to Unix Latin-1. And Windows Unicode (UTF-16) files can be converted to Unix Unicode (UTF-8) files.</p>
<p>Binary files are automatically skipped, unless conversion is forced.</p>
<p>Non-regular files, such as directories and FIFOs, are automatically skipped.</p>
<p>Symbolic links and their targets are by default kept untouched. Symbolic links can optionally be replaced, or the output can be written to the symbolic link target. Writing to a symbolic link target is not supported on Windows.</p>
<p>Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one important difference with the original SunOS/Solaris version. This version does by default in-place conversion (old file mode), while the original SunOS/Solaris version only supports paired conversion (new file mode). See also options <code>-o</code> and <code>-n</code>.</p>
<h1 id="OPTIONS">OPTIONS</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Treat all following options as file names. Use this option if you want to convert files whose names start with a dash. For instance to convert a file named &quot;-foo&quot;, you can use this command:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>Or in new file mode:</p>
<pre><code> dos2unix -n -- -foo out.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>Convert only line breaks. This is the default conversion mode.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Conversion between DOS and ISO-8859-1 character set. See also section CONVERSION MODES.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>Use Windows code page 1252 (Western European).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>Use DOS code page 437 (US). This is the default code page used for ISO conversion.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>Use DOS code page 850 (Western European).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>Use DOS code page 860 (Portuguese).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>Use DOS code page 863 (French Canadian).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>Use DOS code page 865 (Nordic).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Convert 8 bit characters to 7 bit space.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>Keep Byte Order Mark (BOM). When the input file has a BOM, write a BOM in the output file. This is the default behavior when converting to DOS line breaks. See also option <code>-r</code>.</p>
</dd>
<dt id="c---convmode-CONVMODE"><b>-c, --convmode CONVMODE</b></dt>
<dd>
<p>Set conversion mode. Where CONVMODE is one of: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i> with ascii being the default.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>Force conversion of binary files.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>On Windows UTF-16 files are by default converted to UTF-8, regardless of the locale setting. Use this option to convert UTF-16 files to GB18030. This option is only available on Windows. See also section GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>Display help and exit.</p>
</dd>
<dt id="i-FLAGS---info-FLAGS-FILE"><b>-i[FLAGS], --info[=FLAGS] FILE ...</b></dt>
<dd>
<p>Display file information. No conversion is done.</p>
<p>The following information is printed, in this order: number of DOS line breaks, number of Unix line breaks, number of Mac line breaks, byte order mark, text or binary, file name.</p>
<p>Example output:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Optionally extra flags can be set to change the output. One or more flags can be added.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Print number of DOS line breaks.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Print number of Unix line breaks.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Print number of Mac line breaks.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>Print the byte order mark.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Print if file is text or binary.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Print only the files that would be converted.</p>
<p>With the <code>c</code> flag dos2unix will print only the files that contain DOS line breaks, unix2dos will print only file names that have Unix line breaks.</p>
</dd>
</dl>
<p>Examples:</p>
<p>Show information for all *.txt files:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Show only the number of DOS line breaks and Unix line breaks:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Show only the byte order mark:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>List the files that have DOS line breaks:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>List the files that have Unix line breaks:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>Keep the date stamp of output file same as input file.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>Display program&#39;s license.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>Add additional newline.</p>
<p><b>dos2unix</b>: Only DOS line breaks are changed to two Unix line breaks. In Mac mode only Mac line breaks are changed to two Unix line breaks.</p>
<p><b>unix2dos</b>: Only Unix line breaks are changed to two DOS line breaks. In Mac mode Unix line breaks are changed to two Mac line breaks.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>Write a Byte Order Mark (BOM) in the output file. By default an UTF-8 BOM is written.</p>
<p>When the input file is UTF-16, and the option <code>-u</code> is used, an UTF-16 BOM will be written.</p>
<p>Never use this option when the output encoding is other than UTF-8 or UTF-16. See also section UNICODE.</p>
</dd>
<dt id="n---newfile-INFILE-OUTFILE"><b>-n, --newfile INFILE OUTFILE ...</b></dt>
<dd>
<p>New file mode. Convert file INFILE and write output to file OUTFILE. File names must be given in pairs and wildcard names should <i>not</i> be used or you <i>will</i> lose your files.</p>
<p>The person who starts the conversion in new file (paired) mode will be the owner of the converted file. The read/write permissions of the new file will be the permissions of the original file minus the umask(1) of the person who runs the conversion.</p>
</dd>
<dt id="o---oldfile-FILE"><b>-o, --oldfile FILE ...</b></dt>
<dd>
<p>Old file mode. Convert file FILE and overwrite output to it. The program defaults to run in this mode. Wildcard names may be used.</p>
<p>In old file (in-place) mode the converted file gets the same owner, group, and read/write permissions as the original file. Also when the file is converted by another user who has write permissions on the file (e.g. user root). The conversion will be aborted when it is not possible to preserve the original values. Change of owner could mean that the original owner is not able to read the file any more. Change of group could be a security risk, the file could be made readable for persons for whom it is not intended. Preservation of owner, group, and read/write permissions is only supported on Unix.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Quiet mode. Suppress all warnings and messages. The return value is zero. Except when wrong command-line options are used.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>Remove Byte Order Mark (BOM). Do not write a BOM in the output file. This is the default behavior when converting to Unix line breaks. See also option <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>Skip binary files (default).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>Keep the original UTF-16 encoding of the input file. The output file will be written in the same UTF-16 encoding, little or big endian, as the input file. This prevents transformation to UTF-8. An UTF-16 BOM will be written accordingly. This option can be disabled with the <code>-ascii</code> option.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>Assume that the input file format is UTF-16LE.</p>
<p>When there is a Byte Order Mark in the input file the BOM has priority over this option.</p>
<p>When you made a wrong assumption (the input file was not in UTF-16LE format) and the conversion succeeded, you will get an UTF-8 output file with wrong text. You can undo the wrong conversion with iconv(1) by converting the UTF-8 output file back to UTF-16LE. This will bring back the original file.</p>
<p>The assumption of UTF-16LE works as a <i>conversion mode</i>. By switching to the default <i>ascii</i> mode the UTF-16LE assumption is turned off.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>Assume that the input file format is UTF-16BE.</p>
<p>This option works the same as option <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>Display verbose messages. Extra information is displayed about Byte Order Marks and the amount of converted line breaks.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>Follow symbolic links and convert the targets.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>Replace symbolic links with converted files (original target files remain unchanged).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>Keep symbolic links and targets unchanged (default).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>Display version information and exit.</p>
</dd>
</dl>
<h1 id="MAC-MODE">MAC MODE</h1>
<p>In normal mode line breaks are converted from DOS to Unix and vice versa. Mac line breaks are not converted.</p>
<p>In Mac mode line breaks are converted from Mac to Unix and vice versa. DOS line breaks are not changed.</p>
<p>To run in Mac mode use the command-line option <code>-c mac</code> or use the commands <code>mac2unix</code> or <code>unix2mac</code>.</p>
<h1 id="CONVERSION-MODES">CONVERSION MODES</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>In mode <code>ascii</code> only line breaks are converted. This is the default conversion mode.</p>
<p>Although the name of this mode is ASCII, which is a 7 bit standard, the actual mode is 8 bit. Use always this mode when converting Unicode UTF-8 files.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>In this mode all 8 bit non-ASCII characters (with values from 128 to 255) are converted to a 7 bit space.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Characters are converted between a DOS character set (code page) and ISO character set ISO-8859-1 (Latin-1) on Unix. DOS characters without ISO-8859-1 equivalent, for which conversion is not possible, are converted to a dot. The same counts for ISO-8859-1 characters without DOS counterpart.</p>
<p>When only option <code>-iso</code> is used dos2unix will try to determine the active code page. When this is not possible dos2unix will use default code page CP437, which is mainly used in the USA. To force a specific code page use options <code>-437</code> (US), <code>-850</code> (Western European), <code>-860</code> (Portuguese), <code>-863</code> (French Canadian), or <code>-865</code> (Nordic). Windows code page CP1252 (Western European) is also supported with option <code>-1252</code>. For other code pages use dos2unix in combination with iconv(1). Iconv can convert between a long list of character encodings.</p>
<p>Never use ISO conversion on Unicode text files. It will corrupt UTF-8 encoded files.</p>
<p>Some examples:</p>
<p>Convert from DOS default code page to Unix Latin-1:</p>
<pre><code> dos2unix -iso -n in.txt out.txt</code></pre>
<p>Convert from DOS CP850 to Unix Latin-1:</p>
<pre><code> dos2unix -850 -n in.txt out.txt</code></pre>
<p>Convert from Windows CP1252 to Unix Latin-1:</p>
<pre><code> dos2unix -1252 -n in.txt out.txt</code></pre>
<p>Convert from Windows CP1252 to Unix UTF-8 (Unicode):</p>
<pre><code> iconv -f CP1252 -t UTF-8 in.txt | dos2unix &gt; out.txt</code></pre>
<p>Convert from Unix Latin-1 to DOS default code page:</p>
<pre><code> unix2dos -iso -n in.txt out.txt</code></pre>
<p>Convert from Unix Latin-1 to DOS CP850:</p>
<pre><code> unix2dos -850 -n in.txt out.txt</code></pre>
<p>Convert from Unix Latin-1 to Windows CP1252:</p>
<pre><code> unix2dos -1252 -n in.txt out.txt</code></pre>
<p>Convert from Unix UTF-8 (Unicode) to Windows CP1252:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t CP1252 &gt; out.txt</code></pre>
<p>See also <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> and <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Encodings">Encodings</h2>
<p>There exist different Unicode encodings. On Unix and Linux Unicode files are typically encoded in UTF-8 encoding. On Windows Unicode text files can be encoded in UTF-8, UTF-16, or UTF-16 big endian, but are mostly encoded in UTF-16 format.</p>
<h2 id="Conversion">Conversion</h2>
<p>Unicode text files can have DOS, Unix or Mac line breaks, like regular text files.</p>
<p>All versions of dos2unix and unix2dos can convert UTF-8 encoded files, because UTF-8 was designed for backward compatibility with ASCII.</p>
<p>Dos2unix and unix2dos with Unicode UTF-16 support, can read little and big endian UTF-16 encoded text files. To see if dos2unix was built with UTF-16 support type <code>dos2unix -V</code>.</p>
<p>On Unix/Linux UTF-16 encoded files are converted to the locale character encoding. Use the locale(1) command to find out what the locale character encoding is. When conversion is not possible a conversion error will occur and the file will be skipped.</p>
<p>On Windows UTF-16 files are by default converted to UTF-8. UTF-8 formatted text files are well supported on both Windows and Unix/Linux.</p>
<p>UTF-16 and UTF-8 encoding are fully compatible, there will no text be lost in the conversion. When an UTF-16 to UTF-8 conversion error occurs, for instance when the UTF-16 input file contains an error, the file will be skipped.</p>
<p>When option <code>-u</code> is used, the output file will be written in the same UTF-16 encoding as the input file. Option <code>-u</code> prevents conversion to UTF-8.</p>
<p>Dos2unix and unix2dos have no option to convert UTF-8 files to UTF-16.</p>
<p>ISO and 7-bit mode conversion do not work on UTF-16 files.</p>
<h2 id="Byte-Order-Mark">Byte Order Mark</h2>
<p>On Windows Unicode text files typically have a Byte Order Mark (BOM), because many Windows programs (including Notepad) add BOMs by default. See also <a href="http://en.wikipedia.org/wiki/Byte_order_mark">http://en.wikipedia.org/wiki/Byte_order_mark</a>.</p>
<p>On Unix Unicode files typically don&#39;t have a BOM. It is assumed that text files are encoded in the locale character encoding.</p>
<p>Dos2unix can only detect if a file is in UTF-16 format if the file has a BOM. When an UTF-16 file doesn&#39;t have a BOM, dos2unix will see the file as a binary file.</p>
<p>Use option <code>-ul</code> or <code>-ub</code> to convert an UTF-16 file without BOM.</p>
<p>Dos2unix writes by default no BOM in the output file. With option <code>-b</code> Dos2unix writes a BOM when the input file has a BOM.</p>
<p>Unix2dos writes by default a BOM in the output file when the input file has a BOM. Use option <code>-r</code> to remove the BOM.</p>
<p>Dos2unix and unix2dos write always a BOM when option <code>-m</code> is used.</p>
<h2 id="Unicode-examples">Unicode examples</h2>
<p>Convert from Windows UTF-16 (with BOM) to Unix UTF-8:</p>
<pre><code> dos2unix -n in.txt out.txt</code></pre>
<p>Convert from Windows UTF-16LE (without BOM) to Unix UTF-8:</p>
<pre><code> dos2unix -ul -n in.txt out.txt</code></pre>
<p>Convert from Unix UTF-8 to Windows UTF-8 with BOM:</p>
<pre><code> unix2dos -m -n in.txt out.txt</code></pre>
<p>Convert from Unix UTF-8 to Windows UTF-16:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t UTF-16 &gt; out.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 is a Chinese government standard. A mandatory subset of the GB18030 standard is officially required for all software products sold in China. See also <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 is fully compatible with Unicode, and can be considered an unicode transformation format. Like UTF-8, GB18030 is compatible with ASCII. GB18030 is also compatible with Windows code page 936, also known as GBK.</p>
<p>On Unix/Linux UTF-16 files are converted to GB18030 when the locale encoding is set to GB18030. Note that this will only work if the location is set to China. E.g. in an English British locale setting <code>en_GB.GB18030</code> conversion of UTF-16 to GB18030 will not work, but in a Chinese <code>zh_CN.GB18030</code> locale setting it will work.</p>
<p>On Windows you need to use option <code>-gb</code> to convert UTF-16 files to GB18030.</p>
<p>GB18030 encoded files can have a Byte Order Mark, like Unicode files.</p>
<h1 id="EXAMPLES">EXAMPLES</h1>
<p>Read input from &#39;stdin&#39; and write output to &#39;stdout&#39;:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Convert and replace a.txt. Convert and replace b.txt:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Convert and replace a.txt in ascii conversion mode:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Convert and replace a.txt in ascii conversion mode, convert and replace b.txt in 7bit conversion mode:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Convert a.txt from Mac to Unix format:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Convert a.txt from Unix to Mac format:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Convert and replace a.txt while keeping original date stamp:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Convert a.txt and write to e.txt:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Convert and replace a.txt, convert b.txt and write to e.txt:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Convert c.txt and write to e.txt, convert and replace a.txt, convert and replace b.txt, convert d.txt and write to f.txt:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="RECURSIVE-CONVERSION">RECURSIVE CONVERSION</h1>
<p>Use dos2unix in combination with the find(1) and xargs(1) commands to recursively convert text files in a directory tree structure. For instance to convert all .txt files in the directory tree under the current directory type:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="LOCALIZATION">LOCALIZATION</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>The primary language is selected with the environment variable LANG. The LANG variable consists out of several parts. The first part is in small letters the language code. The second is optional and is the country code in capital letters, preceded with an underscore. There is also an optional third part: character encoding, preceded with a dot. A few examples for POSIX standard type shells:</p>
<pre><code> export LANG=nl Dutch
export LANG=nl_NL Dutch, The Netherlands
export LANG=nl_BE Dutch, Belgium
export LANG=es_ES Spanish, Spain
export LANG=es_MX Spanish, Mexico
export LANG=en_US.iso88591 English, USA, Latin-1 encoding
export LANG=en_GB.UTF-8 English, UK, UTF-8 encoding</code></pre>
<p>For a complete list of language and country codes see the gettext manual: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>On Unix systems you can use the command locale(1) to get locale specific information.</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>With the LANGUAGE environment variable you can specify a priority list of languages, separated by colons. Dos2unix gives preference to LANGUAGE over LANG. For instance, first Dutch and then German: <code>LANGUAGE=nl:de</code>. You have to first enable localization, by setting LANG (or LC_ALL) to a value other than &quot;C&quot;, before you can use a language priority list through the LANGUAGE variable. See also the gettext manual: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>If you select a language which is not available you will get the standard English messages.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>With the environment variable DOS2UNIX_LOCALEDIR the LOCALEDIR set during compilation can be overruled. LOCALEDIR is used to find the language files. The GNU default value is <code>/usr/local/share/locale</code>. Option <b>--version</b> will display the LOCALEDIR that is used.</p>
<p>Example (POSIX shell):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="RETURN-VALUE">RETURN VALUE</h1>
<p>On success, zero is returned. When a system error occurs the last system error will be returned. For other errors 1 is returned.</p>
<p>The return value is always zero in quiet mode, except when wrong command-line options are used.</p>
<h1 id="STANDARDS">STANDARDS</h1>
<p><a href="http://en.wikipedia.org/wiki/Text_file">http://en.wikipedia.org/wiki/Text_file</a></p>
<p><a href="http://en.wikipedia.org/wiki/Carriage_return">http://en.wikipedia.org/wiki/Carriage_return</a></p>
<p><a href="http://en.wikipedia.org/wiki/Newline">http://en.wikipedia.org/wiki/Newline</a></p>
<p><a href="http://en.wikipedia.org/wiki/Unicode">http://en.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTHORS">AUTHORS</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (mac2unix mode) - &lt;wuebben@kde.org&gt;, Christian Wurll (add extra newline) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (maintainer)</p>
<p>Project page: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>SourceForge page: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,585 +0,0 @@
NAME
dos2unix - DOS/Mac to Unix and vice versa text file format converter
SYNOPSIS
dos2unix [options] [FILE ...] [-n INFILE OUTFILE ...]
unix2dos [options] [FILE ...] [-n INFILE OUTFILE ...]
DESCRIPTION
The Dos2unix package includes utilities "dos2unix" and "unix2dos" to
convert plain text files in DOS or Mac format to Unix format and vice
versa.
In DOS/Windows text files a line break, also known as newline, is a
combination of two characters: a Carriage Return (CR) followed by a Line
Feed (LF). In Unix text files a line break is a single character: the
Line Feed (LF). In Mac text files, prior to Mac OS X, a line break was
single Carriage Return (CR) character. Nowadays Mac OS uses Unix style
(LF) line breaks.
Besides line breaks Dos2unix can also convert the encoding of files. A
few DOS code pages can be converted to Unix Latin-1. And Windows Unicode
(UTF-16) files can be converted to Unix Unicode (UTF-8) files.
Binary files are automatically skipped, unless conversion is forced.
Non-regular files, such as directories and FIFOs, are automatically
skipped.
Symbolic links and their targets are by default kept untouched. Symbolic
links can optionally be replaced, or the output can be written to the
symbolic link target. Writing to a symbolic link target is not supported
on Windows.
Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
important difference with the original SunOS/Solaris version. This
version does by default in-place conversion (old file mode), while the
original SunOS/Solaris version only supports paired conversion (new file
mode). See also options "-o" and "-n".
OPTIONS
-- Treat all following options as file names. Use this option if you
want to convert files whose names start with a dash. For instance to
convert a file named "-foo", you can use this command:
dos2unix -- -foo
Or in new file mode:
dos2unix -n -- -foo out.txt
-ascii
Convert only line breaks. This is the default conversion mode.
-iso
Conversion between DOS and ISO-8859-1 character set. See also
section CONVERSION MODES.
-1252
Use Windows code page 1252 (Western European).
-437
Use DOS code page 437 (US). This is the default code page used for
ISO conversion.
-850
Use DOS code page 850 (Western European).
-860
Use DOS code page 860 (Portuguese).
-863
Use DOS code page 863 (French Canadian).
-865
Use DOS code page 865 (Nordic).
-7 Convert 8 bit characters to 7 bit space.
-b, --keep-bom
Keep Byte Order Mark (BOM). When the input file has a BOM, write a
BOM in the output file. This is the default behavior when converting
to DOS line breaks. See also option "-r".
-c, --convmode CONVMODE
Set conversion mode. Where CONVMODE is one of: *ascii*, *7bit*,
*iso*, *mac* with ascii being the default.
-f, --force
Force conversion of binary files.
-gb, --gb18030
On Windows UTF-16 files are by default converted to UTF-8,
regardless of the locale setting. Use this option to convert UTF-16
files to GB18030. This option is only available on Windows. See also
section GB18030.
-h, --help
Display help and exit.
-i[FLAGS], --info[=FLAGS] FILE ...
Display file information. No conversion is done.
The following information is printed, in this order: number of DOS
line breaks, number of Unix line breaks, number of Mac line breaks,
byte order mark, text or binary, file name.
Example output:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Optionally extra flags can be set to change the output. One or more
flags can be added.
d Print number of DOS line breaks.
u Print number of Unix line breaks.
m Print number of Mac line breaks.
b Print the byte order mark.
t Print if file is text or binary.
c Print only the files that would be converted.
With the "c" flag dos2unix will print only the files that
contain DOS line breaks, unix2dos will print only file names
that have Unix line breaks.
Examples:
Show information for all *.txt files:
dos2unix -i *.txt
Show only the number of DOS line breaks and Unix line breaks:
dos2unix -idu *.txt
Show only the byte order mark:
dos2unix --info=b *.txt
List the files that have DOS line breaks:
dos2unix -ic *.txt
List the files that have Unix line breaks:
unix2dos -ic *.txt
-k, --keepdate
Keep the date stamp of output file same as input file.
-L, --license
Display program's license.
-l, --newline
Add additional newline.
dos2unix: Only DOS line breaks are changed to two Unix line breaks.
In Mac mode only Mac line breaks are changed to two Unix line
breaks.
unix2dos: Only Unix line breaks are changed to two DOS line breaks.
In Mac mode Unix line breaks are changed to two Mac line breaks.
-m, --add-bom
Write a Byte Order Mark (BOM) in the output file. By default an
UTF-8 BOM is written.
When the input file is UTF-16, and the option "-u" is used, an
UTF-16 BOM will be written.
Never use this option when the output encoding is other than UTF-8
or UTF-16. See also section UNICODE.
-n, --newfile INFILE OUTFILE ...
New file mode. Convert file INFILE and write output to file OUTFILE.
File names must be given in pairs and wildcard names should *not* be
used or you *will* lose your files.
The person who starts the conversion in new file (paired) mode will
be the owner of the converted file. The read/write permissions of
the new file will be the permissions of the original file minus the
umask(1) of the person who runs the conversion.
-o, --oldfile FILE ...
Old file mode. Convert file FILE and overwrite output to it. The
program defaults to run in this mode. Wildcard names may be used.
In old file (in-place) mode the converted file gets the same owner,
group, and read/write permissions as the original file. Also when
the file is converted by another user who has write permissions on
the file (e.g. user root). The conversion will be aborted when it is
not possible to preserve the original values. Change of owner could
mean that the original owner is not able to read the file any more.
Change of group could be a security risk, the file could be made
readable for persons for whom it is not intended. Preservation of
owner, group, and read/write permissions is only supported on Unix.
-q, --quiet
Quiet mode. Suppress all warnings and messages. The return value is
zero. Except when wrong command-line options are used.
-r, --remove-bom
Remove Byte Order Mark (BOM). Do not write a BOM in the output file.
This is the default behavior when converting to Unix line breaks.
See also option "-b".
-s, --safe
Skip binary files (default).
-u, --keep-utf16
Keep the original UTF-16 encoding of the input file. The output file
will be written in the same UTF-16 encoding, little or big endian,
as the input file. This prevents transformation to UTF-8. An UTF-16
BOM will be written accordingly. This option can be disabled with
the "-ascii" option.
-ul, --assume-utf16le
Assume that the input file format is UTF-16LE.
When there is a Byte Order Mark in the input file the BOM has
priority over this option.
When you made a wrong assumption (the input file was not in UTF-16LE
format) and the conversion succeeded, you will get an UTF-8 output
file with wrong text. You can undo the wrong conversion with
iconv(1) by converting the UTF-8 output file back to UTF-16LE. This
will bring back the original file.
The assumption of UTF-16LE works as a *conversion mode*. By
switching to the default *ascii* mode the UTF-16LE assumption is
turned off.
-ub, --assume-utf16be
Assume that the input file format is UTF-16BE.
This option works the same as option "-ul".
-v, --verbose
Display verbose messages. Extra information is displayed about Byte
Order Marks and the amount of converted line breaks.
-F, --follow-symlink
Follow symbolic links and convert the targets.
-R, --replace-symlink
Replace symbolic links with converted files (original target files
remain unchanged).
-S, --skip-symlink
Keep symbolic links and targets unchanged (default).
-V, --version
Display version information and exit.
MAC MODE
In normal mode line breaks are converted from DOS to Unix and vice
versa. Mac line breaks are not converted.
In Mac mode line breaks are converted from Mac to Unix and vice versa.
DOS line breaks are not changed.
To run in Mac mode use the command-line option "-c mac" or use the
commands "mac2unix" or "unix2mac".
CONVERSION MODES
ascii
In mode "ascii" only line breaks are converted. This is the default
conversion mode.
Although the name of this mode is ASCII, which is a 7 bit standard,
the actual mode is 8 bit. Use always this mode when converting
Unicode UTF-8 files.
7bit
In this mode all 8 bit non-ASCII characters (with values from 128 to
255) are converted to a 7 bit space.
iso Characters are converted between a DOS character set (code page) and
ISO character set ISO-8859-1 (Latin-1) on Unix. DOS characters
without ISO-8859-1 equivalent, for which conversion is not possible,
are converted to a dot. The same counts for ISO-8859-1 characters
without DOS counterpart.
When only option "-iso" is used dos2unix will try to determine the
active code page. When this is not possible dos2unix will use
default code page CP437, which is mainly used in the USA. To force a
specific code page use options -437 (US), -850 (Western European),
-860 (Portuguese), -863 (French Canadian), or -865 (Nordic). Windows
code page CP1252 (Western European) is also supported with option
-1252. For other code pages use dos2unix in combination with
iconv(1). Iconv can convert between a long list of character
encodings.
Never use ISO conversion on Unicode text files. It will corrupt
UTF-8 encoded files.
Some examples:
Convert from DOS default code page to Unix Latin-1:
dos2unix -iso -n in.txt out.txt
Convert from DOS CP850 to Unix Latin-1:
dos2unix -850 -n in.txt out.txt
Convert from Windows CP1252 to Unix Latin-1:
dos2unix -1252 -n in.txt out.txt
Convert from Windows CP1252 to Unix UTF-8 (Unicode):
iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt
Convert from Unix Latin-1 to DOS default code page:
unix2dos -iso -n in.txt out.txt
Convert from Unix Latin-1 to DOS CP850:
unix2dos -850 -n in.txt out.txt
Convert from Unix Latin-1 to Windows CP1252:
unix2dos -1252 -n in.txt out.txt
Convert from Unix UTF-8 (Unicode) to Windows CP1252:
unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt
See also <http://czyborra.com/charsets/codepages.html> and
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Encodings
There exist different Unicode encodings. On Unix and Linux Unicode files
are typically encoded in UTF-8 encoding. On Windows Unicode text files
can be encoded in UTF-8, UTF-16, or UTF-16 big endian, but are mostly
encoded in UTF-16 format.
Conversion
Unicode text files can have DOS, Unix or Mac line breaks, like regular
text files.
All versions of dos2unix and unix2dos can convert UTF-8 encoded files,
because UTF-8 was designed for backward compatibility with ASCII.
Dos2unix and unix2dos with Unicode UTF-16 support, can read little and
big endian UTF-16 encoded text files. To see if dos2unix was built with
UTF-16 support type "dos2unix -V".
On Unix/Linux UTF-16 encoded files are converted to the locale character
encoding. Use the locale(1) command to find out what the locale
character encoding is. When conversion is not possible a conversion
error will occur and the file will be skipped.
On Windows UTF-16 files are by default converted to UTF-8. UTF-8
formatted text files are well supported on both Windows and Unix/Linux.
UTF-16 and UTF-8 encoding are fully compatible, there will no text be
lost in the conversion. When an UTF-16 to UTF-8 conversion error occurs,
for instance when the UTF-16 input file contains an error, the file will
be skipped.
When option "-u" is used, the output file will be written in the same
UTF-16 encoding as the input file. Option "-u" prevents conversion to
UTF-8.
Dos2unix and unix2dos have no option to convert UTF-8 files to UTF-16.
ISO and 7-bit mode conversion do not work on UTF-16 files.
Byte Order Mark
On Windows Unicode text files typically have a Byte Order Mark (BOM),
because many Windows programs (including Notepad) add BOMs by default.
See also <http://en.wikipedia.org/wiki/Byte_order_mark>.
On Unix Unicode files typically don't have a BOM. It is assumed that
text files are encoded in the locale character encoding.
Dos2unix can only detect if a file is in UTF-16 format if the file has a
BOM. When an UTF-16 file doesn't have a BOM, dos2unix will see the file
as a binary file.
Use option "-ul" or "-ub" to convert an UTF-16 file without BOM.
Dos2unix writes by default no BOM in the output file. With option "-b"
Dos2unix writes a BOM when the input file has a BOM.
Unix2dos writes by default a BOM in the output file when the input file
has a BOM. Use option "-r" to remove the BOM.
Dos2unix and unix2dos write always a BOM when option "-m" is used.
Unicode examples
Convert from Windows UTF-16 (with BOM) to Unix UTF-8:
dos2unix -n in.txt out.txt
Convert from Windows UTF-16LE (without BOM) to Unix UTF-8:
dos2unix -ul -n in.txt out.txt
Convert from Unix UTF-8 to Windows UTF-8 with BOM:
unix2dos -m -n in.txt out.txt
Convert from Unix UTF-8 to Windows UTF-16:
unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt
GB18030
GB18030 is a Chinese government standard. A mandatory subset of the
GB18030 standard is officially required for all software products sold
in China. See also <http://en.wikipedia.org/wiki/GB_18030>.
GB18030 is fully compatible with Unicode, and can be considered an
unicode transformation format. Like UTF-8, GB18030 is compatible with
ASCII. GB18030 is also compatible with Windows code page 936, also known
as GBK.
On Unix/Linux UTF-16 files are converted to GB18030 when the locale
encoding is set to GB18030. Note that this will only work if the
location is set to China. E.g. in an English British locale setting
"en_GB.GB18030" conversion of UTF-16 to GB18030 will not work, but in a
Chinese "zh_CN.GB18030" locale setting it will work.
On Windows you need to use option "-gb" to convert UTF-16 files to
GB18030.
GB18030 encoded files can have a Byte Order Mark, like Unicode files.
EXAMPLES
Read input from 'stdin' and write output to 'stdout':
dos2unix
dos2unix -l -c mac
Convert and replace a.txt. Convert and replace b.txt:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Convert and replace a.txt in ascii conversion mode:
dos2unix a.txt
Convert and replace a.txt in ascii conversion mode, convert and replace
b.txt in 7bit conversion mode:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Convert a.txt from Mac to Unix format:
dos2unix -c mac a.txt
mac2unix a.txt
Convert a.txt from Unix to Mac format:
unix2dos -c mac a.txt
unix2mac a.txt
Convert and replace a.txt while keeping original date stamp:
dos2unix -k a.txt
dos2unix -k -o a.txt
Convert a.txt and write to e.txt:
dos2unix -n a.txt e.txt
Convert a.txt and write to e.txt, keep date stamp of e.txt same as
a.txt:
dos2unix -k -n a.txt e.txt
Convert and replace a.txt, convert b.txt and write to e.txt:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Convert c.txt and write to e.txt, convert and replace a.txt, convert and
replace b.txt, convert d.txt and write to f.txt:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
RECURSIVE CONVERSION
Use dos2unix in combination with the find(1) and xargs(1) commands to
recursively convert text files in a directory tree structure. For
instance to convert all .txt files in the directory tree under the
current directory type:
find . -name *.txt |xargs dos2unix
LOCALIZATION
LANG
The primary language is selected with the environment variable LANG.
The LANG variable consists out of several parts. The first part is
in small letters the language code. The second is optional and is
the country code in capital letters, preceded with an underscore.
There is also an optional third part: character encoding, preceded
with a dot. A few examples for POSIX standard type shells:
export LANG=nl Dutch
export LANG=nl_NL Dutch, The Netherlands
export LANG=nl_BE Dutch, Belgium
export LANG=es_ES Spanish, Spain
export LANG=es_MX Spanish, Mexico
export LANG=en_US.iso88591 English, USA, Latin-1 encoding
export LANG=en_GB.UTF-8 English, UK, UTF-8 encoding
For a complete list of language and country codes see the gettext
manual:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
On Unix systems you can use the command locale(1) to get locale
specific information.
LANGUAGE
With the LANGUAGE environment variable you can specify a priority
list of languages, separated by colons. Dos2unix gives preference to
LANGUAGE over LANG. For instance, first Dutch and then German:
"LANGUAGE=nl:de". You have to first enable localization, by setting
LANG (or LC_ALL) to a value other than "C", before you can use a
language priority list through the LANGUAGE variable. See also the
gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
If you select a language which is not available you will get the
standard English messages.
DOS2UNIX_LOCALEDIR
With the environment variable DOS2UNIX_LOCALEDIR the LOCALEDIR set
during compilation can be overruled. LOCALEDIR is used to find the
language files. The GNU default value is "/usr/local/share/locale".
Option --version will display the LOCALEDIR that is used.
Example (POSIX shell):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
RETURN VALUE
On success, zero is returned. When a system error occurs the last system
error will be returned. For other errors 1 is returned.
The return value is always zero in quiet mode, except when wrong
command-line options are used.
STANDARDS
<http://en.wikipedia.org/wiki/Text_file>
<http://en.wikipedia.org/wiki/Carriage_return>
<http://en.wikipedia.org/wiki/Newline>
<http://en.wikipedia.org/wiki/Unicode>
AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) - <wuebben@kde.org>, Christian Wurll (add extra newline) -
<wurll@ira.uka.de>, Erwin Waterlander - <waterlan@xs4all.nl>
(maintainer)
Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
SourceForge page: <http://sourceforge.net/projects/dos2unix/>
SEE ALSO
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - Convertidor de archivos de texto de formato DOS/Mac a Unix y viceversa</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NOMBRE">NOMBRE</a></li>
<li><a href="#SINOPSIS">SINOPSIS</a></li>
<li><a href="#DESCRIPCIN">DESCRIPCI&Oacute;N</a></li>
<li><a href="#PARMETROS">PAR&Aacute;METROS</a></li>
<li><a href="#MODO-MAC">MODO MAC</a></li>
<li><a href="#MODOS-DE-CONVERSIN">MODOS DE CONVERSI&Oacute;N</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Codificaciones">Codificaciones</a></li>
<li><a href="#Conversion">Conversion</a></li>
<li><a href="#Marca-de-orden-de-bytes">Marca de orden de bytes</a></li>
<li><a href="#Ejemplos-Unicode">Ejemplos Unicode</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#EJEMPLOS">EJEMPLOS</a></li>
<li><a href="#CONVERSIN-RECURSIVA">CONVERSI&Oacute;N RECURSIVA</a></li>
<li><a href="#INTERNACIONALIZACIN">INTERNACIONALIZACI&Oacute;N</a></li>
<li><a href="#VALOR-DE-RETORNO">VALOR DE RETORNO</a></li>
<li><a href="#ESTNDARES">EST&Aacute;NDARES</a></li>
<li><a href="#AUTORES">AUTORES</a></li>
<li><a href="#VASE-TAMBIN">V&Eacute;ASE TAMBI&Eacute;N</a></li>
</ul>
<h1 id="NOMBRE">NOMBRE</h1>
<p>dos2unix - Convertidor de archivos de texto de formato DOS/Mac a Unix y viceversa</p>
<h1 id="SINOPSIS">SINOPSIS</h1>
<pre><code> dos2unix [par&aacute;metros] [ARCHIVO ...] [-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
unix2dos [par&aacute;metros] [ARCHIVO ...] [-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]</code></pre>
<h1 id="DESCRIPCIN">DESCRIPCI&Oacute;N</h1>
<p>El paquete Dos2unix incluye las herramientas <code>dos2unix</code> y <code>unix2dos</code> para convertir archivos de texto plano en formato DOS o Mac a formato Unix y viceversa.</p>
<p>En archivos de texto DOS/Windows, un salto de l&iacute;nea, tambi&eacute;n conocido como nueva l&iacute;nea, es una combinaci&oacute;n de dos caracteres: un retorno de carro (CR) seguido por un salto de l&iacute;nea (LF). En archivos de texto Unix, un salto de l&iacute;nea es solamente un car&aacute;cter: el salto de l&iacute;nea (LF). En archivos de texto Mac, antes de Mac OS X, un salto de l&iacute;nea era s&oacute;lo un car&aacute;cter retorno de carro (CR). Actualmente, Mac OS usa el estilo Unix de saltos de l&iacute;nea (LF).</p>
<p>Adem&aacute;s de saltos de l&iacute;nea, Dos2unix puede tambi&eacute;n convertir la codificaci&oacute;n de archivos. Unas cuantas p&aacute;ginas de c&oacute;digos DOS pueden ser convertidas a Unix Latin-1. Y archivos Unicode de Windows (UTF-16) pueden ser convertidos a archivos Unicode de Unix (UTF-8).</p>
<p>Los archivos binarios son ignorados autom&aacute;ticamente, a menos que se fuerce su conversi&oacute;n.</p>
<p>Los archivos no regulares, tales como directorios y FIFO, son ignorados autom&aacute;ticamente.</p>
<p>Los enlaces simb&oacute;licos y sus destinos no son modificados por defecto. Los enlaces simb&oacute;licos pueden opcionalmente ser reemplazados, o la salida puede ser escrita al destino simb&oacute;lico del enlace. En Windows no est&aacute; soportada la escritura a enlaces simb&oacute;licos.</p>
<p>Dos2unix fue modelado despu&eacute;s de dos2unix bajo SunOS/Solaris. Hay una importante diferencia respecto a la versi&oacute;n original SunOS/Solaris. Esta versi&oacute;n hace, por defecto, la conversi&oacute;n en el mismo archivo (modo de archivo antiguo), mientras que la versi&oacute;n original de SunOS/Solaris s&oacute;lo es compatible con la conversi&oacute;n en archivo emparejado (modo de archivo nuevo). V&eacute;anse las opciones <code>-o</code> y <code>-n</code>.</p>
<h1 id="PARMETROS">PAR&Aacute;METROS</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Todos los par&aacute;metros siguientes son tratados como nombres de archivo. Use este par&aacute;metro si desea convertir archivos cuyos nombres inician con un gui&oacute;n. Por ejemplo para convertir un archivoo llamado &quot;-foo&quot;, use este comando:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>O en modo de archivo nuevo:</p>
<pre><code> dos2unix -n -- -foo out.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>S&oacute;lo convierte los salto de l&iacute;nea. &Eacute;ste es el modo de conversi&oacute;n por defecto.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Conversi&oacute;n entre el conjunto de caracteres DOS e ISO-8859-1. V&eacute;ase tambi&eacute;n la secci&oacute;n MODOS DE CONVERSI&Oacute;N.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos Windows 1252 (Europa Occidental).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos DOS 437 (EE. UU.). Est&aacute; es la p&aacute;gina de c&oacute;digos usada por defecto para conversi&oacute;n ISO.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos DOS 850 (Europa Occidental).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos DOS 860 (Portugu&eacute;s).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos DOS 863 (Francocanadiense).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>Usa la p&aacute;gina de c&oacute;digos DOS 865 (N&oacute;rdico).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Convierte caracteres de 8 bits al espacio de 7 bits.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>Mantiene la Marca de Orden de Byte (BOM). Cuando el archivo de entrada tiene BOM, escribe BOM en el archivo de salida. Este es el comportamiento por defecto en la conversi&oacute;n a saltos de l&iacute;nea DOS. Vea tambi&eacute;n la opci&oacute;n <code>-r</code>.</p>
</dd>
<dt id="c---convmode-CONVMODE"><b>-c, --convmode CONVMODE</b></dt>
<dd>
<p>Establece el modo de conversi&oacute;n, Donde CONVMODE puede ser: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i> siendo ascii el valor por defecto.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>Fuerza la conversi&oacute;n de archivos binarios.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>En Windows los archivos UTF-16 se convierten por defecto a UTF-8, sin tener en cuenta la configuraci&oacute;n local. Use esta opci&oacute;n para convertir archivos UTF-16 a GB18030. Esta opci&oacute;n s&oacute;lo est&aacute; disponible en Windows.l V&eacute;ase tambi&eacute;n la secci&oacute;n GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>Despiega la ayuda y termina el programa.</p>
</dd>
<dt id="i-MARCAS---info-MARCAS-ARCHIVO"><b>-i[MARCAS], --info[= MARCAS] ARCHIVO ...</b></dt>
<dd>
<p>Muestra la informaci&oacute;n del archivo. No se realiza ninguna conversi&oacute;n.</p>
<p>Se muestra la siguiente informaci&oacute;n, en este orden: n&uacute;mero de saltos de l&iacute;nea DOS, n&uacute;mero de saltos de l&iacute;nea Unix, n&uacute;mero de saltos de l&iacute;nea Mac, Marca de Orden de Byte, de texto o binario, nombre del archivo.</p>
<p>Ejemplo de salida:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Se pueden utilizar marcas extras opcionales para modificar la salida. Se pueden a&ntilde;adir una o m&aacute;s marcas.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Muestra el n&uacute;mero de saltos de l&iacute;nea DOS.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Muestra el n&uacute;mero de saltos de l&iacute;nea Unix.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Muestra el n&uacute;mero de saltos de l&iacute;nea Mac.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>Muestra la Marca de Orden de Byte.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Muestra si el archivo es de texto o binario.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Muestra s&oacute;lo los archivos que pueden ser convertidos.</p>
<p>Con la marca <code>c</code> dos2unix s&oacute;lo mostrar&aacute; los archivos que contengan saltos de l&iacute;nea DOS, unix2dos s&oacute;lo mostrar&aacute; los nombres de archivo que tengan saltos de l&iacute;nea Unix.</p>
</dd>
</dl>
<p>Ejemplos:</p>
<p>Muestra informaci&oacute;n para todos los archivos *.txt:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Muestra s&oacute;lo el n&uacute;mero de saltos de l&iacute;nea de DOS y de Unix:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Muestra s&oacute;lo la Marca de Orden de Byte.</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>Muestra los archivos que tienen saltos de l&iacute;nea DOS:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>Muestra los archivos que tienen saltos de l&iacute;nea Unix:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>Mantiene la fecha del archivo de salida igual a la del archivo de entrada.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>Muestra la licencia del programa.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>A&ntilde;ade salto de l&iacute;nea adicional.</p>
<p><b>dos2unix</b>: S&oacute;lo los saltos de l&iacute;nea DOS son cambiados por dos saltos de l&iacute;nea Unix. En modo Mac s&oacute;lo los saltos de l&iacute;nea Mac son cambiados por dos saltos de l&iacute;nea Unix.</p>
<p><b>unix2dos</b>: S&oacute;lo los saltos de l&iacute;nea Unix son cambiados por dos saltos de l&iacute;nea DOS. En modo Mac los saltos de l&iacute;nea Unix son cambiados por dos saltos de l&iacute;nea Mac.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>Escribe una Marca de Orden de Bytes (BOM) en el archivo de salida. Por defecto se escribe una BOM UTF-8.</p>
<p>Cuando el archivo de entrada es UTF-16 y se usa la opci&oacute;n <code>-u</code>, se escribir&aacute; un BOM UTF-16.</p>
<p>No utilice esta opci&oacute;n cuando la codificaci&oacute;n de salida sea distinta de UTF-8 o UTF-16. V&eacute;ase tambi&eacute;n la secci&oacute;n UNICODE.</p>
</dd>
<dt id="n---newfile-ARCHIVO_DE_ENTRADA-ARCHIVO_DE_SALIDA"><b>-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...</b></dt>
<dd>
<p>Modo de archivo nuevo. Convierte el archivo ARCHIVO_DE_ENTRADA y escribe la salida al archivo ARCHIVO_DE_SALIDA. Los nombres de archivo deben ser dados en pares y los comodines <i>no</i> deben ser usados o <i>perder&aacute;</i> sus archivos.</p>
<p>La persona que inicia la conversi&oacute;n en el modo de archivo nuevo (emparejado) ser&aacute; el propietario del archivo convertido. Los permisos de lectura/escritura del archivo nuevo ser&aacute;n los permisos del archivo original menos la umask(1) de la persona que ejecute la conversi&oacute;n.</p>
</dd>
<dt id="o---oldfile-ARCHIVO"><b>-o, --oldfile ARCHIVO ...</b></dt>
<dd>
<p>Modo de archivo antiguo. Convierte el archivo ARCHIVO y lo sobrescribe con la salida. El programa por defecto se ejecuta en este modo. Se pueden emplear comodines.</p>
<p>En modo de archivo antiguo (in situ), el archivo convertido tiene el mismo propietario, grupo y permisos de lectura/escritura que el archivo original. Lo mismo aplica cuando el archivo es convertido por otro usuario que tiene permiso de lectura en el archivo (p.e. usuario root). La conversi&oacute;n ser&aacute; abortada cuando no sea posible preservar los valores originales. Cambiar el propietario implicar&iacute;a que el propietario original ya no podr&aacute; leer el archivo. Cambiar el grupo podr&iacute;a ser un riesgo de seguridad, ya que el archivo podr&iacute;a ser accesible a personas inadecuadas. La preservaci&oacute;n del propietario, grupo, y permisos de lectura/escritura s&oacute;lo est&aacute; soportada bajo Unix.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Modo silencioso. Suprime todas las advertencias y mensajes. El valor retornado es cero. Excepto cuando se emplean par&aacute;metros incorrectos.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>Elimina la Marca de Orden de Byte (BOM). No escribe el BOM en el archivo de salida. Este es el comportamiento por defecto al convertir a saltos de l&iacute;nea Unix. Vea tambi&eacute;n la opci&oacute;n <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>Ignora los archivos binarios (por defecto).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>Mantiene la codificaci&oacute;n original UTF-16 en el archivo de entrada. El archivo de salida se escribir&aacute; con la misma codificaci&oacute;n UTF-16, little o big endian, como el archivo de entrada. Esto impide la transformaci&oacute;n a UTF-8. En consecuencia se escribir&aacute; un BOM UTF-16. Esta opci&oacute;n se puede desactivar con la opci&oacute;n <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>Se asume que el formato de archivo de entrada es UTF-16LE.</p>
<p>Cuando existe una Marca de Orden de Bytes (BOM) en el archivo de entrada, la BOM tiene prioridad sobre esta opci&oacute;n.</p>
<p>Cuando se hace una suposici&oacute;n incorrecta (el archivo de entrada no estaba en formato UTF-16LE) y la conversi&oacute;n tiene &eacute;xito, obtendr&aacute; un archivo UTF-8 de salida con el texto err&oacute;neo. La conversi&oacute;n err&oacute;nea puede deshacerse con iconv(1) convirtiendo el archivo UTF-8 de salida de vuelta a UTF-16LE. Esto restaurar&aacute; el archivo original.</p>
<p>El supuesto de UTF-16LE funciona como un <i>modo de conversi&oacute;n</i>. Al cambiar al modo por defecto <i>ascii</i> el supuesto UTF-16LE es deshabilitado.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>Se asume que el formato del archivo de entrada es UTF-16BE.</p>
<p>Esta opci&oacute;n funciona igual que la opci&oacute;n <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>Mostrar mensajes detallados. Se muestra informaci&oacute;n extra acerca de Marcas de Orden de Bytes (BOM) y el n&uacute;mero de saltos de l&iacute;nea convertidos.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>Sigue los enlaces simb&oacute;licos y convierte los destinos.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>Reemplaza los enlaces simb&oacute;licos con los archivos convertidos (los archivos destino originales no se alteran).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>No altera los enlaces simb&oacute;licos ni sus destinos (por defecto).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>Despiega la informaci&oacute;n de la versi&oacute;n y termina el programa.</p>
</dd>
</dl>
<h1 id="MODO-MAC">MODO MAC</h1>
<p>En modo normal los saltos de l&iacute;nea son convertidos de DOS a Unix y viceversa. Los saltos de l&iacute;nea Mac no son convertidos.</p>
<p>En modo Mac los saltos de l&iacute;nea son convertidos de Mac a Unix y viceversa. Los saltos de l&iacute;nea DOS no son modificados.</p>
<p>Para ejecutar en modo Mac use el modificador <code>-c mac</code> o use los comandos <code>mac2unix</code> o <code>unix2mac</code>.</p>
<h1 id="MODOS-DE-CONVERSIN">MODOS DE CONVERSI&Oacute;N</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>En modo <code>ascii</code> s&oacute;lo los saltos de l&iacute;nea son convertidos. &Eacute;ste es el modo de conversi&oacute;n por defecto.</p>
<p>Aunque el nombre de este modo es ASCII, que es un est&aacute;ndar de 7 bits, &eacute;ste emplea 8 bits. Siempre use este modo cuando convierta archivos Unicode UTF-8.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>En este modo todos los caracteres no ASCII de 8 bits (con valores de 128 a 255) son convertidos al espacio de 7 bits.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Los caracteres son convertidos entre un conjunto de caracteres DOS (p&aacute;gina de c&oacute;digos) y el conjunto de caracteres ISO-8859-1 (Lat&iacute;n-1) de Unix. Los caracteres DOS sin equivalente ISO-8859-1, para los cuales la conversi&oacute;n es imposible, son convertidos en un punto. Lo mismo se aplica para caracteres ISO-8859-1 sin contraparte DOS.</p>
<p>Cuando s&oacute;lo se emplea el par&aacute;metro <code>-iso</code>, dos2unix intentar&aacute; determinar la p&aacute;gina de c&oacute;digos activa. Cuando esto no sea posible, dos2unix utilizar&aacute; la p&aacute;gina de c&oacute;digos 437 por defecto, la cual es empleada principalmente en EE. UU. Para forzar una p&aacute;gina de c&oacute;digos espec&iacute;fica emplee los par&aacute;metros <code>-437</code> (EE. UU.), <code>-850</code> (Europa Occidental), <code>-860</code> (Portugu&eacute;s), <code>-863</code> (Francocanadiense), o <code>-865</code> (N&oacute;rdico). La p&aacute;gina de c&oacute;digos Windows 1252 (Europa Occidental) tambi&eacute;n est&aacute; soportada con el par&aacute;metro <code>-1252</code>. Para acceder a otras p&aacute;ginas de c&oacute;digos use dos2unix en combinaci&oacute;n con iconv(1). Iconv puede convertir entre una larga lista de codificaciones de caracteres.</p>
<p>No use la conversi&oacute;n ISO en archivos de texto Unicode. Esto corromper&iacute;a los archivos codificados como UTF-8.</p>
<p>Algunos ejemplos:</p>
<p>Convierte de la p&aacute;gina de c&oacute;digos por defecto de DOS a Lat&iacute;n-1 de Unix:</p>
<pre><code> dos2unix -iso -n in.txt out.txt</code></pre>
<p>Convierte de DOS CP850 a Unix Lat&iacute;n-1:</p>
<pre><code> dos2unix -850 -n in.txt out.txt</code></pre>
<p>Convierte de Windows CP1252 a Unix Latin-1:</p>
<pre><code> dos2unix -1252 -n in.txt out.txt</code></pre>
<p>Convierte de Windows CP1252 a Unix UTF-8 (Unicode).</p>
<pre><code> iconv -f CP1252 -t UTF-8 in.txt | dos2unix &gt; out.txt</code></pre>
<p>Convierte de Unix Latin-1 a la p&aacute;gina de c&oacute;digos por defecto de DOS:</p>
<pre><code> unix2dos -iso -n in.txt out.txt</code></pre>
<p>Convierte de Unix Latin-1 a DOS CP850:</p>
<pre><code> unix2dos -850 -n in.txt out.txt</code></pre>
<p>Convierte de Unix Latin-1 a Windows CP1252.</p>
<pre><code> unix2dos -1252 -n in.txt out.txt</code></pre>
<p>Convierte de Unix UTF-8 (Unicode) a Windows CP1252:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t CP1252 &gt; out.txt</code></pre>
<p>V&eacute;ase tambi&eacute;n <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> y <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Codificaciones">Codificaciones</h2>
<p>Existen diferentes codificaciones Unicode. En Unix y Linux los archivos Unicode son codificados com&uacute;nmente en UTF-8. En Windows los archivos de texto Unicode pueden estar codificados en UTF-8, UTF-16, o UTF-16 big endian, pero en general son codificados en formato UTF-16.</p>
<h2 id="Conversion">Conversion</h2>
<p>Los archivos de texto Unicode pueden tener saltos de l&iacute;nea DOS, Unix o Mac, como cualquier archivo de texto.</p>
<p>Todas las versiones de dos2unix y unix2dos pueden convertir archivos codificados como UTF-8, debido a que UTF-8 fue dise&ntilde;ado para retro-compatibilidad con ASCII.</p>
<p>Dos2unix y unix2dos con soporte Unicode UTF-16, pueden leer archivos de texto codificados como UTF-16 little y big endian. Para ver si dos2unix fue compilado con soporte UTF-16 escriba <code>dos2unix -V</code>.</p>
<p>En Unix/Linux los archivos codificados con UTF-16 se convierten a la codificaci&oacute;n de caracteres local. Use el comando locale(1) para averiguar la codificaci&oacute;n de caracteres local. Cuando no se puede hacer la conversi&oacute;n se obtendr&aacute; un error de conversi&oacute;n y se omitir&aacute; el archivo.</p>
<p>En Windows los archivos UTF-16 se convierten por defecto a UTF-8. Los archivos de texto forrajeados con UTF-8 est&aacute;n soportados tanto en Windows como en Unix/Linux.</p>
<p>Las codificaciones UTF-16 y UTF-8 son totalmente compatibles, no se perder&aacute; ning&uacute;n texto en la conversi&oacute;n. Cuando ocurre un error de conversi&oacute;n de UTF-16 a UTF-8, por ejemplo cuando el archivo de entrada UTF-16 contiene un error, se omitir&aacute; el archivo.</p>
<p>Cuando se usa la opci&oacute;n <code>-u</code>, el archivo de salida se escribir&aacute; en la misma codificaci&oacute;n UTF-16 que el archivo de entrada. La opci&oacute;n <code>-u</code> previene la conversi&oacute;n a UTF-8.</p>
<p>Dos2unix y unix2dos no tienen la opci&oacute;n de convertir archivos UTF-8 a UTF-16.</p>
<p>La conversi&oacute;n en modos ISO y 7-bit no funciona en archivos UTF-16.</p>
<h2 id="Marca-de-orden-de-bytes">Marca de orden de bytes</h2>
<p>En Windows los archivos de texto Unicode t&iacute;picamente tienen una Marca de Orden de Bytes (BOM), debido a que muchos programas de Windows (incluyendo el Bloc de Notas) a&ntilde;aden una BOM por defecto. V&eacute;ase tambi&eacute;n <a href="http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29">http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29</a>.</p>
<p>En Unix los archivos Unicode no suelen tener BOM. Se supone que los archivos de texto son codificados en la codificaci&oacute;n local de caracteres.</p>
<p>Dos2unix s&oacute;lo puede detectar si un archivo est&aacute; en formato UTF-16 si el archivo tiene una BOM. Cuando un archivo UTF-16 no tiene una BOM, dos2unix tratar&aacute; el archivo como un archivo binario.</p>
<p>Use la opci&oacute;n <code>-ul</code> o <code>-ub</code> para convertir un archivo UTF-16 sin BOM.</p>
<p>Dos2Unix, por defecto, no escribe BOM en el archivo de salida. Con la opci&oacute;n <code>-b</code> Dos2unix escribe el BOM cuando el archivo de entrada tiene BOM.</p>
<p>Unix2dos escribe BOM en el archivo de salida cuando el archivo de entrada tiene BOM. Use la opci&oacute;n <code>-r</code> para eliminar la BOM.</p>
<p>Dos2unix y unix2dos escriben siempre BOM cuando se usa la opci&oacute;n <code>-m</code>.</p>
<h2 id="Ejemplos-Unicode">Ejemplos Unicode</h2>
<p>Convertir de Windows UTF-16 (con una BOM) a Unix UTF-8:</p>
<pre><code> dos2unix -n in.txt out.txt</code></pre>
<p>Convertir de Windows UTF-16LE (sin una BOM) a Unix UTF-8:</p>
<pre><code> dos2unix -ul -n in.txt out.txt</code></pre>
<p>Convertir de Unix UTF-8 a Windows UTF-8 sin una BOM:</p>
<pre><code> unix2dos -m -n in.txt out.txt</code></pre>
<p>Convertir de Unix UTF-8 a Windows UTF-16:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t UTF-16 &gt; out.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 es un est&aacute;ndar del gobierno chino. Todo producto software vendido en China est&aacute; obligado por ley a contener un subconjunto del GB18030 est&aacute;ndar. V&eacute;ase <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 es totalmente compatible con Unicode y puede considerarse como formato de transformaci&oacute;n Unicode. Como ocurre con UTF-8, GB18030 es compatible con ASCII. GB18030 tambi&eacute;n es compatible con la p&aacute;gina de c&oacute;digos de Windows 936, tambi&eacute;n conocida como GBK.</p>
<p>En Unix/Linux los archivos UTF-16 se convierten a GB18030 cuando la codificaci&oacute;n local se establece en GB18030. Tenga en cuenta que esto s&oacute;lo funcionar&aacute; si se establece la ubicaci&oacute;n en China. Por ejemplo en una configuraci&oacute;n local English British la conversi&oacute;n <code>en_GB.GB18030</code> de UTF-16 a GB18030 no funcionar&aacute;, pero en una configuraci&oacute;n local China <code>zh_CN.GB18030</code> s&iacute; lo har&aacute;.</p>
<p>Use la opci&oacute;n <code>-ul</code> o <code>-ub</code> para convertir un archivo UTF-16 sin BOM.</p>
<p>Los archivos codificados como GB18030 pueden tener una Marca de Orden de Bytes, como ocurre con los archivos Unicode.</p>
<h1 id="EJEMPLOS">EJEMPLOS</h1>
<p>Lee la entrada desde &#39;stdin&#39; y escribe la salida a &#39;stdout&#39;:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Convierte y reemplaza a.txt empleando modo de conversi&oacute;n ascii:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Convierte y reemplaza a.txt empleando modo de conversi&oacute;n ascii, convierte y reemplaza b.txt empleando modo de conversi&oacute;n de 7bits:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Convierte a.txt del formato de Mac a Unix:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Convierte a.txt del formato de Unix a Mac:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Convierte y reemplaza a.txt manteniendo la fecha del archivo original:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Convierte a.txt y escribe la salida en e.txt:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de e.txt igual a la de a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt, convierte y reemplaza b.txt, convierte d.txt y escribe en f.txt:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="CONVERSIN-RECURSIVA">CONVERSI&Oacute;N RECURSIVA</h1>
<p>Use dos2unix en combinaci&oacute;n con los comandos find(1) y xargs(1) para convertir recursivamente archivos de texto contenidos en un &aacute;rbol de directorios. Por ejemplo para convertir todos los archivos .txt en el &aacute;rbol de directorios debajo del directorio actual escriba:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="INTERNACIONALIZACIN">INTERNACIONALIZACI&Oacute;N</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>El idioma principal se selecciona con la variable de entorno LANG. La variable LANG consiste de varias partes. La primer parte es el c&oacute;digo del idioma en min&uacute;sculas. La segunda es opcional y es el c&oacute;digo del pa&iacute;s en may&uacute;sculas, precedido por un gui&oacute;n bajo. Existe tambi&eacute;n una tercera parte opcional: la codificaci&oacute;n de caracteres, precedida por un punto. Unos cuantos ejemplos para int&eacute;rpretes de comandos tipo POSIX est&aacute;ndar:</p>
<pre><code> export LANG=nl Neerland&eacute;s
export LANG=nl_NL Neerland&eacute;s, Pa&iacute;ses Bajos
export LANG=nl_BE Neerland&eacute;s, B&eacute;lgica
export LANG=es_ES Espa&ntilde;ol, Espa&ntilde;a
export LANG=es_MX Espa&ntilde;ol, M&eacute;xico
export LANG=en_US.iso88591 Ingles, EE. UU., codificaci&oacute;n Lat&iacute;n-1
export LANG=en_GB.UTF-8 Ingles, Reino Unido, codificaci&oacute;n UTF-8</code></pre>
<p>Para obtener una lista completa de c&oacute;digos de idioma y pa&iacute;s v&eacute;ase el manual de gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>En sistemas Unix puede emplear el comando locale(1) para obtener informaci&oacute;n espec&iacute;fica de locale.</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>Con la variable de entorno LANGUAGE puede especificar una lista de prioridad de los idiomas, separados por dos puntos. Dos2unix da preferencia a LANGUAGE sobre LANG. Por ejemplo, primero neerland&eacute;s y entonces alem&aacute;n: <code>LANGUAGE=nl:de</code>. Para usar una lista de prioridad de idiomas a trav&eacute;s de la variable LANGUAGE tiene que habilitar antes la internacionalizaci&oacute;n, asignando un valor distinto de &quot;C&quot; a LANG (o LC_ALL). V&eacute;ase tambi&eacute;n el manual de gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>Si selecciona un idioma que no est&aacute; disponible el programa funcionar&aacute; en ingles.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Con la variable de entorno DOS2UNIX_LOCALEDIR el LOCALEDIR asignado durante la compilaci&oacute;n puede ser modificado. LOCALEDIR es usado para encontrar los archivos de idioma. El valor por defecto de GNU es <code>/usr/local/share/locale</code>. El par&aacute;metro <b>--version</b> mostrar&aacute; el LOCALEDIR en uso.</p>
<p>Ejemplo (int&eacute;rprete de comandos POSIX):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="VALOR-DE-RETORNO">VALOR DE RETORNO</h1>
<p>Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un error del sistema se regresar&aacute; el &uacute;ltimo n&uacute;mero de error del sistema. Para otros errores se regresa 1.</p>
<p>El valor de retorno es siempre cero en modo silencioso, excepto cuando se emplean par&aacute;metros incorrectos.</p>
<h1 id="ESTNDARES">EST&Aacute;NDARES</h1>
<p><a href="http://es.wikipedia.org/wiki/Documento_de_texto">http://es.wikipedia.org/wiki/Documento_de_texto</a></p>
<p><a href="http://es.wikipedia.org/wiki/Retorno_de_carro">http://es.wikipedia.org/wiki/Retorno_de_carro</a></p>
<p><a href="http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea">http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea</a></p>
<p><a href="http://es.wikipedia.org/wiki/Unicode">http://es.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTORES">AUTORES</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (mac2unix mode) - &lt;wuebben@kde.org&gt;, Christian Wurll (add extra newline) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (maintainer)</p>
<p>P&aacute;gina del proyecto: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>P&aacute;gina de SourceForge: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="VASE-TAMBIN">V&Eacute;ASE TAMBI&Eacute;N</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,617 +0,0 @@
NOMBRE
dos2unix - Convertidor de archivos de texto de formato DOS/Mac a Unix y
viceversa
SINOPSIS
dos2unix [parámetros] [ARCHIVO ...] [-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
unix2dos [parámetros] [ARCHIVO ...] [-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
DESCRIPCIÓN
El paquete Dos2unix incluye las herramientas "dos2unix" y "unix2dos"
para convertir archivos de texto plano en formato DOS o Mac a formato
Unix y viceversa.
En archivos de texto DOS/Windows, un salto de línea, también conocido
como nueva línea, es una combinación de dos caracteres: un retorno de
carro (CR) seguido por un salto de línea (LF). En archivos de texto
Unix, un salto de línea es solamente un carácter: el salto de línea
(LF). En archivos de texto Mac, antes de Mac OS X, un salto de línea era
sólo un carácter retorno de carro (CR). Actualmente, Mac OS usa el
estilo Unix de saltos de línea (LF).
Además de saltos de línea, Dos2unix puede también convertir la
codificación de archivos. Unas cuantas páginas de códigos DOS pueden ser
convertidas a Unix Latin-1. Y archivos Unicode de Windows (UTF-16)
pueden ser convertidos a archivos Unicode de Unix (UTF-8).
Los archivos binarios son ignorados automáticamente, a menos que se
fuerce su conversión.
Los archivos no regulares, tales como directorios y FIFO, son ignorados
automáticamente.
Los enlaces simbólicos y sus destinos no son modificados por defecto.
Los enlaces simbólicos pueden opcionalmente ser reemplazados, o la
salida puede ser escrita al destino simbólico del enlace. En Windows no
está soportada la escritura a enlaces simbólicos.
Dos2unix fue modelado después de dos2unix bajo SunOS/Solaris. Hay una
importante diferencia respecto a la versión original SunOS/Solaris. Esta
versión hace, por defecto, la conversión en el mismo archivo (modo de
archivo antiguo), mientras que la versión original de SunOS/Solaris sólo
es compatible con la conversión en archivo emparejado (modo de archivo
nuevo). Véanse las opciones "-o" y "-n".
PARÁMETROS
-- Todos los parámetros siguientes son tratados como nombres de
archivo. Use este parámetro si desea convertir archivos cuyos
nombres inician con un guión. Por ejemplo para convertir un archivoo
llamado "-foo", use este comando:
dos2unix -- -foo
O en modo de archivo nuevo:
dos2unix -n -- -foo out.txt
-ascii
Sólo convierte los salto de línea. Éste es el modo de conversión por
defecto.
-iso
Conversión entre el conjunto de caracteres DOS e ISO-8859-1. Véase
también la sección MODOS DE CONVERSIÓN.
-1252
Usa la página de códigos Windows 1252 (Europa Occidental).
-437
Usa la página de códigos DOS 437 (EE. UU.). Está es la página de
códigos usada por defecto para conversión ISO.
-850
Usa la página de códigos DOS 850 (Europa Occidental).
-860
Usa la página de códigos DOS 860 (Portugués).
-863
Usa la página de códigos DOS 863 (Francocanadiense).
-865
Usa la página de códigos DOS 865 (Nórdico).
-7 Convierte caracteres de 8 bits al espacio de 7 bits.
-b, --keep-bom
Mantiene la Marca de Orden de Byte (BOM). Cuando el archivo de
entrada tiene BOM, escribe BOM en el archivo de salida. Este es el
comportamiento por defecto en la conversión a saltos de línea DOS.
Vea también la opción "-r".
-c, --convmode CONVMODE
Establece el modo de conversión, Donde CONVMODE puede ser: *ascii*,
*7bit*, *iso*, *mac* siendo ascii el valor por defecto.
-f, --force
Fuerza la conversión de archivos binarios.
-gb, --gb18030
En Windows los archivos UTF-16 se convierten por defecto a UTF-8,
sin tener en cuenta la configuración local. Use esta opción para
convertir archivos UTF-16 a GB18030. Esta opción sólo está
disponible en Windows.l Véase también la sección GB18030.
-h, --help
Despiega la ayuda y termina el programa.
-i[MARCAS], --info[= MARCAS] ARCHIVO ...
Muestra la información del archivo. No se realiza ninguna
conversión.
Se muestra la siguiente información, en este orden: número de saltos
de línea DOS, número de saltos de línea Unix, número de saltos de
línea Mac, Marca de Orden de Byte, de texto o binario, nombre del
archivo.
Ejemplo de salida:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Se pueden utilizar marcas extras opcionales para modificar la
salida. Se pueden añadir una o más marcas.
d Muestra el número de saltos de línea DOS.
u Muestra el número de saltos de línea Unix.
m Muestra el número de saltos de línea Mac.
b Muestra la Marca de Orden de Byte.
t Muestra si el archivo es de texto o binario.
c Muestra sólo los archivos que pueden ser convertidos.
Con la marca "c" dos2unix sólo mostrará los archivos que
contengan saltos de línea DOS, unix2dos sólo mostrará los
nombres de archivo que tengan saltos de línea Unix.
Ejemplos:
Muestra información para todos los archivos *.txt:
dos2unix -i *.txt
Muestra sólo el número de saltos de línea de DOS y de Unix:
dos2unix -idu *.txt
Muestra sólo la Marca de Orden de Byte.
dos2unix --info=b *.txt
Muestra los archivos que tienen saltos de línea DOS:
dos2unix -ic *.txt
Muestra los archivos que tienen saltos de línea Unix:
unix2dos -ic *.txt
-k, --keepdate
Mantiene la fecha del archivo de salida igual a la del archivo de
entrada.
-L, --license
Muestra la licencia del programa.
-l, --newline
Añade salto de línea adicional.
dos2unix: Sólo los saltos de línea DOS son cambiados por dos saltos
de línea Unix. En modo Mac sólo los saltos de línea Mac son
cambiados por dos saltos de línea Unix.
unix2dos: Sólo los saltos de línea Unix son cambiados por dos saltos
de línea DOS. En modo Mac los saltos de línea Unix son cambiados por
dos saltos de línea Mac.
-m, --add-bom
Escribe una Marca de Orden de Bytes (BOM) en el archivo de salida.
Por defecto se escribe una BOM UTF-8.
Cuando el archivo de entrada es UTF-16 y se usa la opción "-u", se
escribirá un BOM UTF-16.
No utilice esta opción cuando la codificación de salida sea distinta
de UTF-8 o UTF-16. Véase también la sección UNICODE.
-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...
Modo de archivo nuevo. Convierte el archivo ARCHIVO_DE_ENTRADA y
escribe la salida al archivo ARCHIVO_DE_SALIDA. Los nombres de
archivo deben ser dados en pares y los comodines *no* deben ser
usados o *perderá* sus archivos.
La persona que inicia la conversión en el modo de archivo nuevo
(emparejado) será el propietario del archivo convertido. Los
permisos de lectura/escritura del archivo nuevo serán los permisos
del archivo original menos la umask(1) de la persona que ejecute la
conversión.
-o, --oldfile ARCHIVO ...
Modo de archivo antiguo. Convierte el archivo ARCHIVO y lo
sobrescribe con la salida. El programa por defecto se ejecuta en
este modo. Se pueden emplear comodines.
En modo de archivo antiguo (in situ), el archivo convertido tiene el
mismo propietario, grupo y permisos de lectura/escritura que el
archivo original. Lo mismo aplica cuando el archivo es convertido
por otro usuario que tiene permiso de lectura en el archivo (p.e.
usuario root). La conversión será abortada cuando no sea posible
preservar los valores originales. Cambiar el propietario implicaría
que el propietario original ya no podrá leer el archivo. Cambiar el
grupo podría ser un riesgo de seguridad, ya que el archivo podría
ser accesible a personas inadecuadas. La preservación del
propietario, grupo, y permisos de lectura/escritura sólo está
soportada bajo Unix.
-q, --quiet
Modo silencioso. Suprime todas las advertencias y mensajes. El valor
retornado es cero. Excepto cuando se emplean parámetros incorrectos.
-r, --remove-bom
Elimina la Marca de Orden de Byte (BOM). No escribe el BOM en el
archivo de salida. Este es el comportamiento por defecto al
convertir a saltos de línea Unix. Vea también la opción "-b".
-s, --safe
Ignora los archivos binarios (por defecto).
-u, --keep-utf16
Mantiene la codificación original UTF-16 en el archivo de entrada.
El archivo de salida se escribirá con la misma codificación UTF-16,
little o big endian, como el archivo de entrada. Esto impide la
transformación a UTF-8. En consecuencia se escribirá un BOM UTF-16.
Esta opción se puede desactivar con la opción "-ascii".
-ul, --assume-utf16le
Se asume que el formato de archivo de entrada es UTF-16LE.
Cuando existe una Marca de Orden de Bytes (BOM) en el archivo de
entrada, la BOM tiene prioridad sobre esta opción.
Cuando se hace una suposición incorrecta (el archivo de entrada no
estaba en formato UTF-16LE) y la conversión tiene éxito, obtendrá un
archivo UTF-8 de salida con el texto erróneo. La conversión errónea
puede deshacerse con iconv(1) convirtiendo el archivo UTF-8 de
salida de vuelta a UTF-16LE. Esto restaurará el archivo original.
El supuesto de UTF-16LE funciona como un *modo de conversión*. Al
cambiar al modo por defecto *ascii* el supuesto UTF-16LE es
deshabilitado.
-ub, --assume-utf16be
Se asume que el formato del archivo de entrada es UTF-16BE.
Esta opción funciona igual que la opción "-ul".
-v, --verbose
Mostrar mensajes detallados. Se muestra información extra acerca de
Marcas de Orden de Bytes (BOM) y el número de saltos de línea
convertidos.
-F, --follow-symlink
Sigue los enlaces simbólicos y convierte los destinos.
-R, --replace-symlink
Reemplaza los enlaces simbólicos con los archivos convertidos (los
archivos destino originales no se alteran).
-S, --skip-symlink
No altera los enlaces simbólicos ni sus destinos (por defecto).
-V, --version
Despiega la información de la versión y termina el programa.
MODO MAC
En modo normal los saltos de línea son convertidos de DOS a Unix y
viceversa. Los saltos de línea Mac no son convertidos.
En modo Mac los saltos de línea son convertidos de Mac a Unix y
viceversa. Los saltos de línea DOS no son modificados.
Para ejecutar en modo Mac use el modificador "-c mac" o use los comandos
"mac2unix" o "unix2mac".
MODOS DE CONVERSIÓN
ascii
En modo "ascii" sólo los saltos de línea son convertidos. Éste es el
modo de conversión por defecto.
Aunque el nombre de este modo es ASCII, que es un estándar de 7
bits, éste emplea 8 bits. Siempre use este modo cuando convierta
archivos Unicode UTF-8.
7bit
En este modo todos los caracteres no ASCII de 8 bits (con valores de
128 a 255) son convertidos al espacio de 7 bits.
iso Los caracteres son convertidos entre un conjunto de caracteres DOS
(página de códigos) y el conjunto de caracteres ISO-8859-1 (Latín-1)
de Unix. Los caracteres DOS sin equivalente ISO-8859-1, para los
cuales la conversión es imposible, son convertidos en un punto. Lo
mismo se aplica para caracteres ISO-8859-1 sin contraparte DOS.
Cuando sólo se emplea el parámetro "-iso", dos2unix intentará
determinar la página de códigos activa. Cuando esto no sea posible,
dos2unix utilizará la página de códigos 437 por defecto, la cual es
empleada principalmente en EE. UU. Para forzar una página de códigos
específica emplee los parámetros -437 (EE. UU.), -850 (Europa
Occidental), -860 (Portugués), -863 (Francocanadiense), o -865
(Nórdico). La página de códigos Windows 1252 (Europa Occidental)
también está soportada con el parámetro -1252. Para acceder a otras
páginas de códigos use dos2unix en combinación con iconv(1). Iconv
puede convertir entre una larga lista de codificaciones de
caracteres.
No use la conversión ISO en archivos de texto Unicode. Esto
corrompería los archivos codificados como UTF-8.
Algunos ejemplos:
Convierte de la página de códigos por defecto de DOS a Latín-1 de
Unix:
dos2unix -iso -n in.txt out.txt
Convierte de DOS CP850 a Unix Latín-1:
dos2unix -850 -n in.txt out.txt
Convierte de Windows CP1252 a Unix Latin-1:
dos2unix -1252 -n in.txt out.txt
Convierte de Windows CP1252 a Unix UTF-8 (Unicode).
iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt
Convierte de Unix Latin-1 a la página de códigos por defecto de DOS:
unix2dos -iso -n in.txt out.txt
Convierte de Unix Latin-1 a DOS CP850:
unix2dos -850 -n in.txt out.txt
Convierte de Unix Latin-1 a Windows CP1252.
unix2dos -1252 -n in.txt out.txt
Convierte de Unix UTF-8 (Unicode) a Windows CP1252:
unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt
Véase también <http://czyborra.com/charsets/codepages.html> y
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Codificaciones
Existen diferentes codificaciones Unicode. En Unix y Linux los archivos
Unicode son codificados comúnmente en UTF-8. En Windows los archivos de
texto Unicode pueden estar codificados en UTF-8, UTF-16, o UTF-16 big
endian, pero en general son codificados en formato UTF-16.
Conversion
Los archivos de texto Unicode pueden tener saltos de línea DOS, Unix o
Mac, como cualquier archivo de texto.
Todas las versiones de dos2unix y unix2dos pueden convertir archivos
codificados como UTF-8, debido a que UTF-8 fue diseñado para
retro-compatibilidad con ASCII.
Dos2unix y unix2dos con soporte Unicode UTF-16, pueden leer archivos de
texto codificados como UTF-16 little y big endian. Para ver si dos2unix
fue compilado con soporte UTF-16 escriba "dos2unix -V".
En Unix/Linux los archivos codificados con UTF-16 se convierten a la
codificación de caracteres local. Use el comando locale(1) para
averiguar la codificación de caracteres local. Cuando no se puede hacer
la conversión se obtendrá un error de conversión y se omitirá el
archivo.
En Windows los archivos UTF-16 se convierten por defecto a UTF-8. Los
archivos de texto forrajeados con UTF-8 están soportados tanto en
Windows como en Unix/Linux.
Las codificaciones UTF-16 y UTF-8 son totalmente compatibles, no se
perderá ningún texto en la conversión. Cuando ocurre un error de
conversión de UTF-16 a UTF-8, por ejemplo cuando el archivo de entrada
UTF-16 contiene un error, se omitirá el archivo.
Cuando se usa la opción "-u", el archivo de salida se escribirá en la
misma codificación UTF-16 que el archivo de entrada. La opción "-u"
previene la conversión a UTF-8.
Dos2unix y unix2dos no tienen la opción de convertir archivos UTF-8 a
UTF-16.
La conversión en modos ISO y 7-bit no funciona en archivos UTF-16.
Marca de orden de bytes
En Windows los archivos de texto Unicode típicamente tienen una Marca de
Orden de Bytes (BOM), debido a que muchos programas de Windows
(incluyendo el Bloc de Notas) añaden una BOM por defecto. Véase también
<http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29>.
En Unix los archivos Unicode no suelen tener BOM. Se supone que los
archivos de texto son codificados en la codificación local de
caracteres.
Dos2unix sólo puede detectar si un archivo está en formato UTF-16 si el
archivo tiene una BOM. Cuando un archivo UTF-16 no tiene una BOM,
dos2unix tratará el archivo como un archivo binario.
Use la opción "-ul" o "-ub" para convertir un archivo UTF-16 sin BOM.
Dos2Unix, por defecto, no escribe BOM en el archivo de salida. Con la
opción "-b" Dos2unix escribe el BOM cuando el archivo de entrada tiene
BOM.
Unix2dos escribe BOM en el archivo de salida cuando el archivo de
entrada tiene BOM. Use la opción "-r" para eliminar la BOM.
Dos2unix y unix2dos escriben siempre BOM cuando se usa la opción "-m".
Ejemplos Unicode
Convertir de Windows UTF-16 (con una BOM) a Unix UTF-8:
dos2unix -n in.txt out.txt
Convertir de Windows UTF-16LE (sin una BOM) a Unix UTF-8:
dos2unix -ul -n in.txt out.txt
Convertir de Unix UTF-8 a Windows UTF-8 sin una BOM:
unix2dos -m -n in.txt out.txt
Convertir de Unix UTF-8 a Windows UTF-16:
unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt
GB18030
GB18030 es un estándar del gobierno chino. Todo producto software
vendido en China está obligado por ley a contener un subconjunto del
GB18030 estándar. Véase <http://en.wikipedia.org/wiki/GB_18030>.
GB18030 es totalmente compatible con Unicode y puede considerarse como
formato de transformación Unicode. Como ocurre con UTF-8, GB18030 es
compatible con ASCII. GB18030 también es compatible con la página de
códigos de Windows 936, también conocida como GBK.
En Unix/Linux los archivos UTF-16 se convierten a GB18030 cuando la
codificación local se establece en GB18030. Tenga en cuenta que esto
sólo funcionará si se establece la ubicación en China. Por ejemplo en
una configuración local English British la conversión "en_GB.GB18030" de
UTF-16 a GB18030 no funcionará, pero en una configuración local China
"zh_CN.GB18030" sí lo hará.
Use la opción "-ul" o "-ub" para convertir un archivo UTF-16 sin BOM.
Los archivos codificados como GB18030 pueden tener una Marca de Orden de
Bytes, como ocurre con los archivos Unicode.
EJEMPLOS
Lee la entrada desde 'stdin' y escribe la salida a 'stdout':
dos2unix
dos2unix -l -c mac
Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Convierte y reemplaza a.txt empleando modo de conversión ascii:
dos2unix a.txt
Convierte y reemplaza a.txt empleando modo de conversión ascii,
convierte y reemplaza b.txt empleando modo de conversión de 7bits:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Convierte a.txt del formato de Mac a Unix:
dos2unix -c mac a.txt
mac2unix a.txt
Convierte a.txt del formato de Unix a Mac:
unix2dos -c mac a.txt
unix2mac a.txt
Convierte y reemplaza a.txt manteniendo la fecha del archivo original:
dos2unix -k a.txt
dos2unix -k -o a.txt
Convierte a.txt y escribe la salida en e.txt:
dos2unix -n a.txt e.txt
Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de
e.txt igual a la de a.txt:
dos2unix -k -n a.txt e.txt
Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt,
convierte y reemplaza b.txt, convierte d.txt y escribe en f.txt:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
CONVERSIÓN RECURSIVA
Use dos2unix en combinación con los comandos find(1) y xargs(1) para
convertir recursivamente archivos de texto contenidos en un árbol de
directorios. Por ejemplo para convertir todos los archivos .txt en el
árbol de directorios debajo del directorio actual escriba:
find . -name *.txt |xargs dos2unix
INTERNACIONALIZACIÓN
LANG
El idioma principal se selecciona con la variable de entorno LANG.
La variable LANG consiste de varias partes. La primer parte es el
código del idioma en minúsculas. La segunda es opcional y es el
código del país en mayúsculas, precedido por un guión bajo. Existe
también una tercera parte opcional: la codificación de caracteres,
precedida por un punto. Unos cuantos ejemplos para intérpretes de
comandos tipo POSIX estándar:
export LANG=nl Neerlandés
export LANG=nl_NL Neerlandés, Países Bajos
export LANG=nl_BE Neerlandés, Bélgica
export LANG=es_ES Español, España
export LANG=es_MX Español, México
export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín-1
export LANG=en_GB.UTF-8 Ingles, Reino Unido, codificación UTF-8
Para obtener una lista completa de códigos de idioma y país véase el
manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
En sistemas Unix puede emplear el comando locale(1) para obtener
información específica de locale.
LANGUAGE
Con la variable de entorno LANGUAGE puede especificar una lista de
prioridad de los idiomas, separados por dos puntos. Dos2unix da
preferencia a LANGUAGE sobre LANG. Por ejemplo, primero neerlandés y
entonces alemán: "LANGUAGE=nl:de". Para usar una lista de prioridad
de idiomas a través de la variable LANGUAGE tiene que habilitar
antes la internacionalización, asignando un valor distinto de "C" a
LANG (o LC_ALL). Véase también el manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Si selecciona un idioma que no está disponible el programa
funcionará en ingles.
DOS2UNIX_LOCALEDIR
Con la variable de entorno DOS2UNIX_LOCALEDIR el LOCALEDIR asignado
durante la compilación puede ser modificado. LOCALEDIR es usado para
encontrar los archivos de idioma. El valor por defecto de GNU es
"/usr/local/share/locale". El parámetro --version mostrará el
LOCALEDIR en uso.
Ejemplo (intérprete de comandos POSIX):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
VALOR DE RETORNO
Se regresa cero cuando el programa termina exitosamente. Cuando ocurre
un error del sistema se regresará el último número de error del sistema.
Para otros errores se regresa 1.
El valor de retorno es siempre cero en modo silencioso, excepto cuando
se emplean parámetros incorrectos.
ESTÁNDARES
<http://es.wikipedia.org/wiki/Documento_de_texto>
<http://es.wikipedia.org/wiki/Retorno_de_carro>
<http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea>
<http://es.wikipedia.org/wiki/Unicode>
AUTORES
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) - <wuebben@kde.org>, Christian Wurll (add extra newline) -
<wurll@ira.uka.de>, Erwin Waterlander - <waterlan@xs4all.nl>
(maintainer)
Página del proyecto: <http://waterlan.home.xs4all.nl/dos2unix.html>
Página de SourceForge: <http://sourceforge.net/projects/dos2unix/>
VÉASE TAMBIÉN
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - Convertit les fichiers textes du format DOS/Mac vers Unix et inversement</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NOM">NOM</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#OPTIONS">OPTIONS</a></li>
<li><a href="#MODE-MAC">MODE MAC</a></li>
<li><a href="#MODES-DE-CONVERSION">MODES DE CONVERSION</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Codages">Codages</a></li>
<li><a href="#Conversion">Conversion</a></li>
<li><a href="#Marque-dordre-des-octets">Marque d&#39;ordre des octets</a></li>
<li><a href="#Exemples-Unicode">Exemples Unicode</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#EXEMPLES">EXEMPLES</a></li>
<li><a href="#CONVERSIONS-RCURSIVES">CONVERSIONS R&Eacute;CURSIVES</a></li>
<li><a href="#PARAMTRES-LINGUISTIQUES">PARAM&Egrave;TRES LINGUISTIQUES</a></li>
<li><a href="#VALEUR-DE-RETOUR">VALEUR DE RETOUR</a></li>
<li><a href="#STANDARDS">STANDARDS</a></li>
<li><a href="#AUTEURS">AUTEURS</a></li>
<li><a href="#VOIR-AUSSI">VOIR AUSSI</a></li>
</ul>
<h1 id="NOM">NOM</h1>
<p>dos2unix - Convertit les fichiers textes du format DOS/Mac vers Unix et inversement</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> dos2unix [options] [FICHIER &hellip;] [-n FICHIER_ENTR&Eacute;E FICHIER_SORTIE &hellip;]
unix2dos [options] [FICHIER &hellip;] [-n FICHIER_ENTR&Eacute;E FICHIER_SORTIE &hellip;]</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>Le package Dos2unix inclut les utilitaires <code>dos2unix</code> et <code>unix2dos</code> pour convertir des fichiers textes au format DOS ou Mac vers le format Unix et inversement.</p>
<p>Dans les fichiers textes DOS/Windows, un saut de ligne est une combinaison de deux caract&egrave;res: un retour de chariot (CR) suivi d&#39;un saut de ligne (LF). Dans les fichiers textes Unix, le saut de ligne est un seul caract&egrave;re: le saut de ligne (LF). Les fichiers textes Mac, avant Mac OS X, utilisaient le retour chariot (CR) comme seul caract&egrave;re. De nos jours, Mac OS utilise le m&ecirc;me style de saut de ligne que Unix (LF).</p>
<p>Outre les sauts de lignes, Dos2unix convertit aussi le codage des fichiers. Quelques codes page DOS peuvent &ecirc;tre convertis en Latin-1 sous Unix. L&#39;Unicode des fichiers Windows (UTF-16) peut &ecirc;tre converti en Unicode Unix (UTF-8).</p>
<p>Les fichiers binaires sont automatiquement ignor&eacute;s &agrave; moins que la conversion soit forc&eacute;e.</p>
<p>Les fichiers non r&eacute;guliers tels que les r&eacute;pertoires et les FIFOs sont automatiquement ignor&eacute;s.</p>
<p>Les liens symboliques et leur cible sont, par d&eacute;faut, inchang&eacute;s. En option, les liens symboliques peuvent &ecirc;tre remplac&eacute;s ou, au choix, la sortie peut &ecirc;tre &eacute;crite dans la cible du lien symbolique. &Eacute;crire dans la cible d&#39;un lien symbolique n&#39;est pas support&eacute; sous Windows.</p>
<p>Dos2unix a &eacute;t&eacute; con&ccedil;u comme dos2unix sous SunOS/Solaris. Il y a une diff&eacute;rence importante avec la version originale de SunOS/Solaris. Cette version effectue les conversions en place (ancien mode de fichiers) tandis que la version originale de SunOS/Solaris ne supporte que la conversion par paire (nouveau mode de fichier). Voyez aussi les options <code>-o</code> et <code>-n</code>.</p>
<h1 id="OPTIONS">OPTIONS</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Traites toutes les options &agrave; sa suite comme &eacute;tant des noms de fichiers. Utilisez cette option si vous voulez convertir des fichiers dont le nom commence par un tiret. Par exemple, pour convertir un fichier nomm&eacute; <span style="white-space: nowrap;">&laquo; -foo &raquo;,</span> vous pouvez utiliser cette commande:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>Ou dans le style des nouveaux fichiers:</p>
<pre><code> dos2unix -n -- -foo sortie.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>Convertit uniquement les sauts de lignes. C&#39;est le mode de conversion par d&eacute;faut.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Convertit le jeu de caract&egrave;res du DOS vers ISO-8859-1. Voyez aussi la section des MODES DE CONVERSION.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>Utilise le code page 1252 de Windows (Europe de l&#39;ouest).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>Utilise le code page 437 du DOS (US). C&#39;est le code page par d&eacute;faut pour les conversions ISO.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>Utilise le code page 850 du DOS (Europe de l&#39;ouest).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>Utilise le code page 860 du DOS (portugais).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>Utilise le code page 863 du DOS (fran&ccedil;ais canadien).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>Utilise le code page 865 du DOS (nordique).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Convertit les caract&egrave;res 8 bits vers l&#39;espace 7 bits.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>Conserve la marque d&#39;ordre des octets (BOM). Si le fichier d&#39;entr&eacute;e a une BOM, elle est &eacute;crite dans le fichier de sortie. C&#39;est le comportement par d&eacute;faut quand les sauts de lignes sont convertis au format DOS. Consultez aussi l&#39;option <code>-r</code>.</p>
</dd>
<dt id="c---convmode-MODE_CONV"><b>-c, --convmode MODE_CONV</b></dt>
<dd>
<p>Change le mode de conversion. MODE_CONV prend l&#39;une des valeurs: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i>. Ascii est la valeur par d&eacute;faut.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>Force la conversion de fichiers binaires.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>Sous Windows, les fichiers UTF-16 sont convertis en UTF-8 par d&eacute;faut sans consid&eacute;ration pour les param&egrave;tres de la localisation. Utilisez cette option pour convertir UTF-16 en GB18030. Cette option n&#39;est disponible que sous Windows. Consultez aussi la section GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>Affiche l&#39;aide et s&#39;arr&ecirc;te.</p>
</dd>
<dt id="i-FANIONS---info-FANIONS-FICHIER"><b>-i[FANIONS], --info[=FANIONS] FICHIER &hellip;</b></dt>
<dd>
<p>Affiche les informations du fichier. Aucune conversion n&#39;est r&eacute;alis&eacute;e.</p>
<p>Les informations suivantes sont affich&eacute;es dans cet ordre: le nombre de sauts de ligne DOS, le nombre de sauts de ligne Unix, le nombre de sauts de ligne Mac, la marque d&#39;ordre des octets, texte ou binaire, nom du fichier.</p>
<p>Exemple de <span style="white-space: nowrap;">sortie :</span></p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Des fanions facultatifs peuvent &ecirc;tre ajout&eacute;s pour changer la sortie. Un ou plusieurs fanions peuvent &ecirc;tre ajout&eacute;s.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Affiche le nombre de sauts de ligne DOS.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Affiche le nombre de sauts de ligne Unix.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Affiche le nombre de sauts de ligne Mac.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>Afficher la marque d&#39;ordre des octets.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Affiche si le fichier est texte ou binaire.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Affiche uniquement les fichiers qui seraient convertis.</p>
<p>Avec le fanion <code>c</code>, dos2unix n&#39;affichera que les fichiers contenant des sauts de ligne DOS alors que unix2dos n&#39;affichera que les noms des fichiers aillant des sauts de ligne Unix.</p>
</dd>
</dl>
<p>Exemples:</p>
<p>Afficher les informations pour tous les fichier <span style="white-space: nowrap;">*.txt :</span></p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Afficher uniquement le nombre de sauts de ligne DOS et <span style="white-space: nowrap;">Unix :</span></p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Montrer uniquement la marque d&#39;ordre des <span style="white-space: nowrap;">octets :</span></p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>Liste les fichiers qui ont des sauts de ligne DOS :</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>Liste les fichiers qui ont des sauts de ligne Unix :</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>La date du fichier de sortie est la m&ecirc;me que celle du fichier d&#39;entr&eacute;e.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>Affiche la licence du programme.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>Ajoute des sauts de lignes additionnels.</p>
<p><b>dos2unix</b>: Seuls les sauts de lignes du DOS sont chang&eacute;s en deux sauts de lignes de Unix. En mode Mac, seuls les sauts de lignes Mac sont chang&eacute;s en deux sauts de lignes Unix.</p>
<p><b>unix2dos</b>: Seuls les sauts de lignes Unix sont chang&eacute;s en deux sauts de lignes du DOS. En mode Mac, les sauts de lignes Unix sont remplac&eacute;s par deux sauts de lignes Mac.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>&Eacute;crit une marque d&#39;ordre des octets (BOM) dans le fichier de sortie. Par d&eacute;faut une BOM UTF-8 est &eacute;crite.</p>
<p>Lorsque le fichier d&#39;entr&eacute;e est en UTF-16 et que l&#39;option <code>-u</code> est utilis&eacute;e, une BOM UTF-16 est &eacute;crite.</p>
<p>N&#39;utilisez jamais cette option quand l&#39;encodage du fichier de sortie n&#39;est ni UTF-8 ni UTF-16. Consultez &eacute;galement la section UNICODE.</p>
</dd>
<dt id="n---newline-FICHIER_ENTRE-FICHIER_SORTIE"><b>-n, --newline FICHIER_ENTR&Eacute;E FICHIER_SORTIE &hellip;</b></dt>
<dd>
<p>Nouveau mode de fichiers. Convertit le fichier FICHER_ENTR&Eacute;E et &eacute;crit la sortie dans le fichier FICHIER_SORTIE. Les noms des fichiers doivent &ecirc;tre indiqu&eacute;s par paires. Les jokers <i>ne</i> doivent <i>pas</i> &ecirc;tre utilis&eacute;s ou vous <i>perdrez</i> vos fichiers.</p>
<p>La personne qui d&eacute;marre la conversion dans le nouveau mode (pair&eacute;) des fichiers sera le propri&eacute;taire du fichier converti. Les permissions de lecture/&eacute;criture du nouveau fichier seront les permissions du fichier original moins le umask(1) de la personne qui ex&eacute;cute la conversion.</p>
</dd>
<dt id="o---oldfile-FICHIER"><b>-o, --oldfile FICHIER &hellip;</b></dt>
<dd>
<p>Ancien mode de fichiers. Convertit le fichier FICHIER et &eacute;crit la sortie dedans. Le programme fonctionne dans ce mode par d&eacute;faut. Les jokers peuvent &ecirc;tre utilis&eacute;s.</p>
<p>Dans l&#39;ancien mode (en place) des fichiers, les fichiers convertis ont le m&ecirc;me propri&eacute;taire, groupe et permissions lecture/&eacute;criture que le fichier original. Idem quand le fichier est converti par un utilisateur qui a la permission d&#39;&eacute;crire dans le fichier (par exemple, root). La conversion est interrompue si il n&#39;est pas possible de conserver les valeurs d&#39;origine. Le changement de propri&eacute;taire pourrait signifier que le propri&eacute;taire original n&#39;est plus en mesure de lire le fichier. Le changement de groupe pourrait &ecirc;tre un risque pour la s&eacute;curit&eacute;. Le fichier pourrait &ecirc;tre rendu accessible en lecture par des personnes &agrave; qui il n&#39;est pas destin&eacute;. La conservation du propri&eacute;taire, du groupe et des permissions de lecture/&eacute;criture n&#39;est support&eacute;e que sous Unix.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Mode silencieux. Supprime les avertissements et les messages. La valeur de sortie est z&eacute;ro sauf quand de mauvaises options sont utilis&eacute;es sur la ligne de commande.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>Supprime la marque d&#39;ordre des octets (BOM). N&#39;&eacute;crit pas la BOM dans le fichier de sortie. Ceci est le comportement par d&eacute;faut lorsque les sauts de lignes sont convertis au format Unix. Consultez aussi l&#39;option <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>Ignore les fichiers binaires (par d&eacute;faut).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>Conserve l&#39;encodage UTF-16 original du fichier d&#39;entr&eacute;e. Le fichier de sortie sera &eacute;crit dans le m&ecirc;me encodage UTF-16 (petit ou grand boutien) que le fichier d&#39;entr&eacute;e. Ceci &eacute;vite la transformation en UTF-8. Une BOM UTF-16 sera &eacute;crite en cons&eacute;quent. Cette option peut &ecirc;tre d&eacute;sactiv&eacute;e avec l&#39;option <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>Suppose que le fichier d&#39;entr&eacute;e est au format UTF-16LE.</p>
<p>Quand il y a un indicateur d&#39;ordre des octets dans le fichier d&#39;entr&eacute;e, l&#39;indicateur a priorit&eacute; sur cette option.</p>
<p>Si vous vous &ecirc;tes tromp&eacute; sur le format du fichier d&#39;entr&eacute;e (par exemple, ce n&#39;&eacute;tait pas un fichier UTF16-LE) et que la conversion r&eacute;ussi, vous obtiendrez un fichier UTF-8 contenant le mauvais texte. Vous pouvez r&eacute;cup&eacute;rer le fichier original avec iconv(1) en convertissant le fichier de sortie UTF-8 vers du UTF-16LE.</p>
<p>La pr&eacute;supposition de l&#39;UTF-16LE fonctionne comme un <i>mode de conversion</i>. En utilisant le mode <i>ascii</i> par d&eacute;faut, UTF-16LE n&#39;est plus pr&eacute;suppos&eacute;.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>Suppose que le fichier d&#39;entr&eacute;e est au format UTF-16BE.</p>
<p>Cette option fonctionne comme l&#39;option <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>Affiche des messages verbeux. Des informations suppl&eacute;mentaires sont affich&eacute;es &agrave; propos des marques d&#39;ordre des octets et du nombre de sauts de lignes convertis.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>Suit les liens symboliques et convertit les cibles.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>Remplace les liens symboliques par les fichiers convertis (les fichiers cibles originaux restent inchang&eacute;s).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>Ne change pas les liens symboliques ni les cibles (par d&eacute;faut).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>Affiche les informations de version puis arr&ecirc;te.</p>
</dd>
</dl>
<h1 id="MODE-MAC">MODE MAC</h1>
<p>En mode normal, les sauts de lignes sont convertis du DOS vers Unix et inversement. Les sauts de lignes Mac ne sont pas convertis.</p>
<p>En mode Mac, les sauts de lignes sont convertis du format Mac au format Unix et inversement. Les sauts de lignes DOS ne sont pas chang&eacute;s.</p>
<p>Pour fonctionner en mode Mac, utilisez l&#39;option en ligne de commande <code>-c mac</code> ou utilisez les commandes <code>mac2unix</code> ou <code>unix2mac</code>.</p>
<h1 id="MODES-DE-CONVERSION">MODES DE CONVERSION</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>En mode <code>ascii</code>, seuls les sauts de lignes sont convertis. Ceci est le mode de conversion par d&eacute;faut.</p>
<p>Bien que le nom de ce mode soit ASCII, qui est un standard 7 bits, ce mode travail en r&eacute;alit&eacute; sur 8 bits. Utilisez toujours ce mode lorsque vous convertissez des fichiers Unicode UTF-8.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>Dans ce mode, tous les caract&egrave;res 8 bits non ASCII (avec des valeurs entre 128 et 255) sont remplac&eacute;s par une espace 7 bits.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Les caract&egrave;res sont convertis entre un jeu de caract&egrave;res DOS (code page) et le jeu de caract&egrave;res ISO-8859-1 (Latin-1) de Unix. Les caract&egrave;res DOS sans &eacute;quivalent ISO-8859-1, pour lesquels la conversion n&#39;est pas possible, sont remplac&eacute;s par un point. La m&ecirc;me chose est valable pour les caract&egrave;res ISO-8859-1 sans &eacute;quivalent DOS.</p>
<p>Quand seule l&#39;option <code>-iso</code> est utilis&eacute;e, dos2unix essaie de d&eacute;terminer le code page actif. Quand ce n&#39;est pas possible, dos2unix utilise le code page CP437 par d&eacute;faut qui est surtout utilis&eacute; aux USA. Pour forcer l&#39;utilisation d&#39;un code page sp&eacute;cifique, utilisez les options <code>-437</code> (US), <code>-850</code> (Europe de l&#39;ouest), <code>-860</code> (portugais), <code>-863</code> (fran&ccedil;ais canadien) ou <code>-865</code> (nordique). Le code page CP1252 de Windows (Europe de l&#39;ouest) est &eacute;galement support&eacute; avec l&#39;option <code>-1252</code>. Pour d&#39;autres codes pages, utilisez dos2unix avec iconv(1). Iconv supporte une longue liste de codages de caract&egrave;res.</p>
<p>N&#39;utilisez jamais la conversion ISO sur des fichiers textes Unicode. Cela va corrompre les fichiers encod&eacute;s en UTF-8.</p>
<p>Quelques exemples:</p>
<p>Convertir du code page par d&eacute;faut du DOS au Latin-1 Unix :</p>
<pre><code> dos2unix -iso -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir du CP850 du DOS au Latin-1 Unix :</p>
<pre><code> dos2unix -850 -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir du CP1252 de Windows au Latin-1 de Unix :</p>
<pre><code> dos2unix -1252 -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir le CP1252 de Windows en UTF-8 de Unix (Unicode) :</p>
<pre><code> iconv -f CP1252 -t UTF-8 entr&eacute;e.txt | dos2unix &gt; sortie.txt</code></pre>
<p>Convertir du Latin-1 de Unix au code page par d&eacute;faut de DOS :</p>
<pre><code> unix2dos -iso -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir le Latin-1 de Unix en CP850 du DOS :</p>
<pre><code> unix2dos -850 -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir le Latin-1 de Unix en CP1252 de Windows :</p>
<pre><code> unix2dos -1252 -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir le UTF-8 de Unix (Unicode) en CP1252 de Windows :</p>
<pre><code> unix2dos &lt; entr&eacute;e.txt | iconv -f UTF-8 -t CP1252 &gt; sortie.txt</code></pre>
<p>Consultez aussi <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> et <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Codages">Codages</h2>
<p>Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers sont g&eacute;n&eacute;ralement cod&eacute;s en UTF-8. Sous Windows, les fichiers textes Unicode peuvent &ecirc;tre cod&eacute;s en UTF-8, UTF-16 ou UTF-16 gros boutien mais ils sont majoritairement cod&eacute;s au format UTF-16.</p>
<h2 id="Conversion">Conversion</h2>
<p>Les fichiers textes Unicode peuvent avoir des sauts de lignes DOS, Unix ou Mac, tout comme les fichiers textes normaux.</p>
<p>Toutes les versions de dos2unix et unix2dos peuvent convertir des fichiers cod&eacute;s en UTF-8 car UTF-8 a &eacute;t&eacute; con&ccedil;u pour &ecirc;tre r&eacute;tro-compatible avec l&#39;ASCII.</p>
<p>Dos2unix et unix2dos, avec le support pour l&#39;Unicode UTF-16, peuvent lire les fichiers textes cod&eacute;s sous forme petit boutien ou gros boutien. Pour savoir si dos2unix a &eacute;t&eacute; compil&eacute; avec le support UTF-16 tapez <code>dos2unix -V</code>.</p>
<p>Sous Unix/Linux, les fichiers encod&eacute;s en UTF-16 sont convertis vers l&#39;encodage des caract&egrave;res de la localisation. Utilisez locale(1) pour d&eacute;couvrir quel encodage de caract&egrave;res est utilis&eacute;. Lorsque la conversion n&#39;est pas possible, une erreur de conversion est produite et le fichier est abandonn&eacute;.</p>
<p>Sous Windows, les fichiers UTF-16 sont convertis par d&eacute;faut en UTF-8. Les fichiers textes format&eacute;s en UTF-8 sont bien support&eacute;s sous Windows et Unix/Linux.</p>
<p>Les codages UTF-16 et UTF-8 sont parfaitement compatibles. Il n&#39;y a pas de pertes lors de la conversion. Lorsqu&#39;une erreur de conversion UTF-16 vers UTF-8 survient, par exemple, quand le fichier d&#39;entr&eacute;e UTF-16 contient une erreur, le fichier est ignor&eacute;.</p>
<p>Quand l&#39;option <code>-u</code> est utilis&eacute;e, le fichier de sortie est &eacute;crit dans le m&ecirc;me encodage UTF-16 que le fichier d&#39;entr&eacute;e. L&#39;option <code>-u</code> emp&ecirc;che la conversion en UTF-8.</p>
<p>Dos2unix et unix2dos n&#39;ont pas d&#39;option pour convertir des fichiers UTF-8 en UTF-16.</p>
<p>Les modes de conversion ISO et 7 bits ne fonctionnent pas sur des fichiers UTF-16.</p>
<h2 id="Marque-dordre-des-octets">Marque d&#39;ordre des octets</h2>
<p>Les fichiers textes Unicode sous Windows on g&eacute;n&eacute;ralement un indicateur d&#39;ordre des octets (BOM) car de nombreux programmes Windows (y compris Notepad) ajoutent cet indicateur par d&eacute;faut. Consultez aussi <a href="http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets">http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets</a>.</p>
<p>Sous Unix, les fichiers Unicodes n&#39;ont habituellement pas de BOM. Il est suppos&eacute; que les fichiers textes sont cod&eacute;s selon le codage de l&#39;environnement linguistique.</p>
<p>Dos2unix ne peut d&eacute;tecter que le fichier est au format UTF-16 si le fichier n&#39;a pas de BOM. Quand le fichier UTF-16 n&#39;a pas cet indicateur, dos2unix voit le fichier comme un fichier binaire.</p>
<p>Utilisez l&#39;option <code>-ul</code> ou <code>-ub</code> pour convertir un fichier UTF-16 sans BOM.</p>
<p>Dos2unix, par d&eacute;faut, n&#39;&eacute;crit pas de BOM dans le fichier de sortie. Avec l&#39;option <code>-b</code>, Dos2unix &eacute;crit une BOM quand le fichier d&#39;entr&eacute;e a une BOM.</p>
<p>Unix2dos &eacute;crit par d&eacute;faut une BOM dans le fichier de sortie quand le fichier d&#39;entr&eacute;e a une BOM. Utilisez l&#39;option <code>-r</code> pour supprimer la BOM.</p>
<p>Dos2unix et unix2dos &eacute;crivent toujours une BOM quand l&#39;option <code>-m</code> est utilis&eacute;e.</p>
<h2 id="Exemples-Unicode">Exemples Unicode</h2>
<p>Convertir de l&#39;UTF-16 Windows (avec BOM) vers l&#39;UTF-8 de Unix :</p>
<pre><code> dos2unix -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir de l&#39;UTF-16LE de Windows (sans BOM) vers l&#39;UTF-8 de Unix :</p>
<pre><code> dos2unix -ul -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir de l&#39;UTF-8 de Unix vers l&#39;UTF-8 de Windows avec BOM :</p>
<pre><code> unix2dos -m -n entr&eacute;e.txt sortie.txt</code></pre>
<p>Convertir de l&#39;UTF-8 de Unix vers l&#39;UTF-16 de Windows :</p>
<pre><code> unix2dos &lt; entr&eacute;e.txt | iconv -f UTF-8 -t UTF-16 &gt; sortie.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 est un standard du gouvernement chinois. Tout logiciel vendu en Chine doit officiellement supporter un sous ensemble obligatoire du standard GB18030. Consultez <a href="http://fr.wikipedia.org/wiki/GB_18030">http://fr.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 est enti&egrave;rement compatible avec Unicode et peut &ecirc;tre consid&eacute;r&eacute; comme &eacute;tant un format de transformation unicode. Comme UTF-8, GB18030 est compatible avec ASCII. GB18030 est aussi compatible avec le code page 936 de Windows aussi connu comme GBK.</p>
<p>Sous Unix/Linux, les fichiers UTF-16 sont convertis en GB18030 quand l&#39;encodage de la localisation est GB18030. Notez que cela ne fonctionnera que si l&#39;emplacement est en Chine. Autrement dit, dans la localisation anglaise britannique <code>en_GB.GB18030</code>, la conversion de UTF-16 vers GB18030 ne fonctionnera pas mais une localisation chinoise <code>zh_CN.GB18030</code> fonctionnera.</p>
<p>Sous Windows, vous avez besoin de l&#39;option <code>-gb</code> pour convertir UTF-16 en GB18030.</p>
<p>Les fichiers encod&eacute;s en GB18030 peuvent avoir une marque d&#39;ordre des octets, comme les fichiers Unicode.</p>
<h1 id="EXEMPLES">EXEMPLES</h1>
<p>Lire l&#39;entr&eacute;e depuis <span style="white-space: nowrap;">&laquo; stdin &raquo;</span> et &eacute;crire la sortie vers <span style="white-space: nowrap;">&laquo; stdout &raquo; :</span></p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Convertir et remplacer a.txt. Convertir et remplace b.txt :</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Convertir et remplacer a.txt en mode de conversion ascii :</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Convertir et remplacer a.txt en mode de conversion ascii. Convertir et remplacer b.txt en mode de conversion 7 bits :</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Convertir a.txt depuis le format Mac vers le format Unix :</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Convertir a.txt du format Unix au format Mac :</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Convertir et remplacer a.txt tout en conservant la date originale :</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Convertir a.txt et &eacute;crire dans e.txt :</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Convertir a.txt et &eacute;crire dans e.txt. La date de e.txt est la m&ecirc;me que celle de a.txt :</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Convertir et remplacer a.txt. Convertir b.txt et &eacute;crire dans e.txt :</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Convertir c.txt et &eacute;crire dans e.txt. Convertir et remplacer a.txt. Convertir et remplacer b.txt. Convertir d.txt et &eacute;crire dans f.txt :</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="CONVERSIONS-RCURSIVES">CONVERSIONS R&Eacute;CURSIVES</h1>
<p>Utilisez dos2unix avec les commandes find(1) et xargs(1) pour convertir r&eacute;cursivement des fichiers textes dans une arborescence de r&eacute;pertoires. Par exemple, pour convertir tous les fichiers .txt dans les r&eacute;pertoires sous le r&eacute;pertoire courant, tapez:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="PARAMTRES-LINGUISTIQUES">PARAM&Egrave;TRES LINGUISTIQUES</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>La langue principale est s&eacute;lectionn&eacute;e par la variable d&#39;environnement LANG. La variable LANG est compos&eacute;e de plusieurs parties. La premi&egrave;re partie est le code de la langue en minuscules. La deuxi&egrave;me partie est le code du pays en majuscules pr&eacute;c&eacute;d&eacute; d&#39;un soulign&eacute;. Elle est facultative. Il y a aussi une troisi&egrave;me partie facultative qui est le codage des caract&egrave;res pr&eacute;c&eacute;d&eacute; par un point. Voici quelques exemples pour un shell au standard POSIX:</p>
<pre><code> export LANG=fr Fran&ccedil;ais
export LANG=fr_CA Fran&ccedil;ais, Canada
export LANG=fr_BE Fran&ccedil;ais, Belgique
export LANG=es_ES Espagnol, Espagne
export LANG=es_MX Espagnol, Mexique
export LANG=en_US.iso88591 Anglais, USA, codage Latin-1
export LANG=en_GB.UTF-8 Anglais, UK, codage UTF-8</code></pre>
<p>La liste compl&egrave;te des codes de langues et de pays est dans le manuel de gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>Sur les syst&egrave;mes Unix, vous pouvez utiliser la commande locale(1) pour obtenir des informations sur l&#39;environnement linguistique.</p>
</dd>
<dt id="LANGUE"><b>LANGUE</b></dt>
<dd>
<p>Avec la variable d&#39;environnement LANGUAGE, vous pouvez sp&eacute;cifier une liste de langues prioritaires s&eacute;par&eacute;es par des deux-points. Dos2unix fait passer LANGUAGE avant LANG. Par exemple, pour utiliser le fran&ccedil;ais avant l&#39;anglais: <code>LANGUAGE=fr:en</code>. Vous devez d&#39;abord activer l&#39;environnement linguistique en assignant une valeur autre que <span style="white-space: nowrap;">&laquo; C &raquo;</span> &agrave; LANG (ou LC_ALL). Ensuite, vous pourrez utiliser la liste de priorit&eacute; avec la variable LANGUAGE. Voyez &eacute;galement le manuel de gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>Si vous s&eacute;lectionnez une langue qui n&#39;est pas disponible, vous obtiendrez des messages en anglais standard.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Gr&acirc;ce &agrave; la variable d&#39;environnement DOS2UNIX_LOCALEDIR, la variable LOCALEDIR compil&eacute;e dans l&#39;application peut &ecirc;tre remplac&eacute;e. LOCALEDIR est utilis&eacute;e pour trouver les fichiers de langue. La valeur par d&eacute;faut de GNU est <code>/usr/local/share/locale</code>. L&#39;option <b>--version</b> affiche la valeur de LOCALEDIR utilis&eacute;e.</p>
<p>Exemple (shell POSIX):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="VALEUR-DE-RETOUR">VALEUR DE RETOUR</h1>
<p>Z&eacute;ro est retourn&eacute; en cas de succ&egrave;s. Si une erreur syst&egrave;me se produit, la derni&egrave;re erreur syst&egrave;me est retourn&eacute;e. Pour les autres erreurs, 1 est renvoy&eacute;.</p>
<p>La valeur de sortie est toujours z&eacute;ro en mode silencieux sauf quand de mauvaises options sont utilis&eacute;es sur la ligne de commande.</p>
<h1 id="STANDARDS">STANDARDS</h1>
<p><a href="http://fr.wikipedia.org/wiki/Fichier_texte">http://fr.wikipedia.org/wiki/Fichier_texte</a></p>
<p><a href="http://fr.wikipedia.org/wiki/Retour_chariot">http://fr.wikipedia.org/wiki/Retour_chariot</a></p>
<p><a href="http://fr.wikipedia.org/wiki/Fin_de_ligne">http://fr.wikipedia.org/wiki/Fin_de_ligne</a></p>
<p><a href="http://fr.wikipedia.org/wiki/Unicode">http://fr.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTEURS">AUTEURS</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (mode mac2unix) - &lt;wuebben@kde.org&gt;, Christian Wurll (ajout de saut de ligne suppl&eacute;mentaire) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (Mainteneur)</p>
<p>Page du projet: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>Page SourceForge: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="VOIR-AUSSI">VOIR AUSSI</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,625 +0,0 @@
NOM
dos2unix - Convertit les fichiers textes du format DOS/Mac vers Unix et
inversement
SYNOPSIS
dos2unix [options] [FICHIER …] [-n FICHIER_ENTRÉE FICHIER_SORTIE …]
unix2dos [options] [FICHIER …] [-n FICHIER_ENTRÉE FICHIER_SORTIE …]
DESCRIPTION
Le package Dos2unix inclut les utilitaires "dos2unix" et "unix2dos" pour
convertir des fichiers textes au format DOS ou Mac vers le format Unix
et inversement.
Dans les fichiers textes DOS/Windows, un saut de ligne est une
combinaison de deux caractères: un retour de chariot (CR) suivi d'un
saut de ligne (LF). Dans les fichiers textes Unix, le saut de ligne est
un seul caractère: le saut de ligne (LF). Les fichiers textes Mac, avant
Mac OS X, utilisaient le retour chariot (CR) comme seul caractère. De
nos jours, Mac OS utilise le même style de saut de ligne que Unix (LF).
Outre les sauts de lignes, Dos2unix convertit aussi le codage des
fichiers. Quelques codes page DOS peuvent être convertis en Latin-1 sous
Unix. L'Unicode des fichiers Windows (UTF-16) peut être converti en
Unicode Unix (UTF-8).
Les fichiers binaires sont automatiquement ignorés à moins que la
conversion soit forcée.
Les fichiers non réguliers tels que les répertoires et les FIFOs sont
automatiquement ignorés.
Les liens symboliques et leur cible sont, par défaut, inchangés. En
option, les liens symboliques peuvent être remplacés ou, au choix, la
sortie peut être écrite dans la cible du lien symbolique. Écrire dans la
cible d'un lien symbolique n'est pas supporté sous Windows.
Dos2unix a été conçu comme dos2unix sous SunOS/Solaris. Il y a une
différence importante avec la version originale de SunOS/Solaris. Cette
version effectue les conversions en place (ancien mode de fichiers)
tandis que la version originale de SunOS/Solaris ne supporte que la
conversion par paire (nouveau mode de fichier). Voyez aussi les options
"-o" et "-n".
OPTIONS
-- Traites toutes les options à sa suite comme étant des noms de
fichiers. Utilisez cette option si vous voulez convertir des
fichiers dont le nom commence par un tiret. Par exemple, pour
convertir un fichier nommé « -foo », vous pouvez utiliser cette
commande:
dos2unix -- -foo
Ou dans le style des nouveaux fichiers:
dos2unix -n -- -foo sortie.txt
-ascii
Convertit uniquement les sauts de lignes. C'est le mode de
conversion par défaut.
-iso
Convertit le jeu de caractères du DOS vers ISO-8859-1. Voyez aussi
la section des MODES DE CONVERSION.
-1252
Utilise le code page 1252 de Windows (Europe de l'ouest).
-437
Utilise le code page 437 du DOS (US). C'est le code page par défaut
pour les conversions ISO.
-850
Utilise le code page 850 du DOS (Europe de l'ouest).
-860
Utilise le code page 860 du DOS (portugais).
-863
Utilise le code page 863 du DOS (français canadien).
-865
Utilise le code page 865 du DOS (nordique).
-7 Convertit les caractères 8 bits vers l'espace 7 bits.
-b, --keep-bom
Conserve la marque d'ordre des octets (BOM). Si le fichier d'entrée
a une BOM, elle est écrite dans le fichier de sortie. C'est le
comportement par défaut quand les sauts de lignes sont convertis au
format DOS. Consultez aussi l'option "-r".
-c, --convmode MODE_CONV
Change le mode de conversion. MODE_CONV prend l'une des valeurs:
*ascii*, *7bit*, *iso*, *mac*. Ascii est la valeur par défaut.
-f, --force
Force la conversion de fichiers binaires.
-gb, --gb18030
Sous Windows, les fichiers UTF-16 sont convertis en UTF-8 par défaut
sans considération pour les paramètres de la localisation. Utilisez
cette option pour convertir UTF-16 en GB18030. Cette option n'est
disponible que sous Windows. Consultez aussi la section GB18030.
-h, --help
Affiche l'aide et s'arrête.
-i[FANIONS], --info[=FANIONS] FICHIER …
Affiche les informations du fichier. Aucune conversion n'est
réalisée.
Les informations suivantes sont affichées dans cet ordre: le nombre
de sauts de ligne DOS, le nombre de sauts de ligne Unix, le nombre
de sauts de ligne Mac, la marque d'ordre des octets, texte ou
binaire, nom du fichier.
Exemple de sortie :
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Des fanions facultatifs peuvent être ajoutés pour changer la sortie.
Un ou plusieurs fanions peuvent être ajoutés.
d Affiche le nombre de sauts de ligne DOS.
u Affiche le nombre de sauts de ligne Unix.
m Affiche le nombre de sauts de ligne Mac.
b Afficher la marque d'ordre des octets.
t Affiche si le fichier est texte ou binaire.
c Affiche uniquement les fichiers qui seraient convertis.
Avec le fanion "c", dos2unix n'affichera que les fichiers
contenant des sauts de ligne DOS alors que unix2dos n'affichera
que les noms des fichiers aillant des sauts de ligne Unix.
Exemples:
Afficher les informations pour tous les fichier *.txt :
dos2unix -i *.txt
Afficher uniquement le nombre de sauts de ligne DOS et Unix :
dos2unix -idu *.txt
Montrer uniquement la marque d'ordre des octets :
dos2unix --info=b *.txt
Liste les fichiers qui ont des sauts de ligne DOS :
dos2unix -ic *.txt
Liste les fichiers qui ont des sauts de ligne Unix :
unix2dos -ic *.txt
-k, --keepdate
La date du fichier de sortie est la même que celle du fichier
d'entrée.
-L, --license
Affiche la licence du programme.
-l, --newline
Ajoute des sauts de lignes additionnels.
dos2unix: Seuls les sauts de lignes du DOS sont changés en deux
sauts de lignes de Unix. En mode Mac, seuls les sauts de lignes Mac
sont changés en deux sauts de lignes Unix.
unix2dos: Seuls les sauts de lignes Unix sont changés en deux sauts
de lignes du DOS. En mode Mac, les sauts de lignes Unix sont
remplacés par deux sauts de lignes Mac.
-m, --add-bom
Écrit une marque d'ordre des octets (BOM) dans le fichier de sortie.
Par défaut une BOM UTF-8 est écrite.
Lorsque le fichier d'entrée est en UTF-16 et que l'option "-u" est
utilisée, une BOM UTF-16 est écrite.
N'utilisez jamais cette option quand l'encodage du fichier de sortie
n'est ni UTF-8 ni UTF-16. Consultez également la section UNICODE.
-n, --newline FICHIER_ENTRÉE FICHIER_SORTIE …
Nouveau mode de fichiers. Convertit le fichier FICHER_ENTRÉE et
écrit la sortie dans le fichier FICHIER_SORTIE. Les noms des
fichiers doivent être indiqués par paires. Les jokers *ne* doivent
*pas* être utilisés ou vous *perdrez* vos fichiers.
La personne qui démarre la conversion dans le nouveau mode (pairé)
des fichiers sera le propriétaire du fichier converti. Les
permissions de lecture/écriture du nouveau fichier seront les
permissions du fichier original moins le umask(1) de la personne qui
exécute la conversion.
-o, --oldfile FICHIER …
Ancien mode de fichiers. Convertit le fichier FICHIER et écrit la
sortie dedans. Le programme fonctionne dans ce mode par défaut. Les
jokers peuvent être utilisés.
Dans l'ancien mode (en place) des fichiers, les fichiers convertis
ont le même propriétaire, groupe et permissions lecture/écriture que
le fichier original. Idem quand le fichier est converti par un
utilisateur qui a la permission d'écrire dans le fichier (par
exemple, root). La conversion est interrompue si il n'est pas
possible de conserver les valeurs d'origine. Le changement de
propriétaire pourrait signifier que le propriétaire original n'est
plus en mesure de lire le fichier. Le changement de groupe pourrait
être un risque pour la sécurité. Le fichier pourrait être rendu
accessible en lecture par des personnes à qui il n'est pas destiné.
La conservation du propriétaire, du groupe et des permissions de
lecture/écriture n'est supportée que sous Unix.
-q, --quiet
Mode silencieux. Supprime les avertissements et les messages. La
valeur de sortie est zéro sauf quand de mauvaises options sont
utilisées sur la ligne de commande.
-r, --remove-bom
Supprime la marque d'ordre des octets (BOM). N'écrit pas la BOM dans
le fichier de sortie. Ceci est le comportement par défaut lorsque
les sauts de lignes sont convertis au format Unix. Consultez aussi
l'option "-b".
-s, --safe
Ignore les fichiers binaires (par défaut).
-u, --keep-utf16
Conserve l'encodage UTF-16 original du fichier d'entrée. Le fichier
de sortie sera écrit dans le même encodage UTF-16 (petit ou grand
boutien) que le fichier d'entrée. Ceci évite la transformation en
UTF-8. Une BOM UTF-16 sera écrite en conséquent. Cette option peut
être désactivée avec l'option "-ascii".
-ul, --assume-utf16le
Suppose que le fichier d'entrée est au format UTF-16LE.
Quand il y a un indicateur d'ordre des octets dans le fichier
d'entrée, l'indicateur a priorité sur cette option.
Si vous vous êtes trompé sur le format du fichier d'entrée (par
exemple, ce n'était pas un fichier UTF16-LE) et que la conversion
réussi, vous obtiendrez un fichier UTF-8 contenant le mauvais texte.
Vous pouvez récupérer le fichier original avec iconv(1) en
convertissant le fichier de sortie UTF-8 vers du UTF-16LE.
La présupposition de l'UTF-16LE fonctionne comme un *mode de
conversion*. En utilisant le mode *ascii* par défaut, UTF-16LE n'est
plus présupposé.
-ub, --assume-utf16be
Suppose que le fichier d'entrée est au format UTF-16BE.
Cette option fonctionne comme l'option "-ul".
-v, --verbose
Affiche des messages verbeux. Des informations supplémentaires sont
affichées à propos des marques d'ordre des octets et du nombre de
sauts de lignes convertis.
-F, --follow-symlink
Suit les liens symboliques et convertit les cibles.
-R, --replace-symlink
Remplace les liens symboliques par les fichiers convertis (les
fichiers cibles originaux restent inchangés).
-S, --skip-symlink
Ne change pas les liens symboliques ni les cibles (par défaut).
-V, --version
Affiche les informations de version puis arrête.
MODE MAC
En mode normal, les sauts de lignes sont convertis du DOS vers Unix et
inversement. Les sauts de lignes Mac ne sont pas convertis.
En mode Mac, les sauts de lignes sont convertis du format Mac au format
Unix et inversement. Les sauts de lignes DOS ne sont pas changés.
Pour fonctionner en mode Mac, utilisez l'option en ligne de commande "-c
mac" ou utilisez les commandes "mac2unix" ou "unix2mac".
MODES DE CONVERSION
ascii
En mode "ascii", seuls les sauts de lignes sont convertis. Ceci est
le mode de conversion par défaut.
Bien que le nom de ce mode soit ASCII, qui est un standard 7 bits,
ce mode travail en réalité sur 8 bits. Utilisez toujours ce mode
lorsque vous convertissez des fichiers Unicode UTF-8.
7bit
Dans ce mode, tous les caractères 8 bits non ASCII (avec des valeurs
entre 128 et 255) sont remplacés par une espace 7 bits.
iso Les caractères sont convertis entre un jeu de caractères DOS (code
page) et le jeu de caractères ISO-8859-1 (Latin-1) de Unix. Les
caractères DOS sans équivalent ISO-8859-1, pour lesquels la
conversion n'est pas possible, sont remplacés par un point. La même
chose est valable pour les caractères ISO-8859-1 sans équivalent
DOS.
Quand seule l'option "-iso" est utilisée, dos2unix essaie de
déterminer le code page actif. Quand ce n'est pas possible, dos2unix
utilise le code page CP437 par défaut qui est surtout utilisé aux
USA. Pour forcer l'utilisation d'un code page spécifique, utilisez
les options -437 (US), -850 (Europe de l'ouest), -860 (portugais),
-863 (français canadien) ou -865 (nordique). Le code page CP1252 de
Windows (Europe de l'ouest) est également supporté avec l'option
-1252. Pour d'autres codes pages, utilisez dos2unix avec iconv(1).
Iconv supporte une longue liste de codages de caractères.
N'utilisez jamais la conversion ISO sur des fichiers textes Unicode.
Cela va corrompre les fichiers encodés en UTF-8.
Quelques exemples:
Convertir du code page par défaut du DOS au Latin-1 Unix :
dos2unix -iso -n entrée.txt sortie.txt
Convertir du CP850 du DOS au Latin-1 Unix :
dos2unix -850 -n entrée.txt sortie.txt
Convertir du CP1252 de Windows au Latin-1 de Unix :
dos2unix -1252 -n entrée.txt sortie.txt
Convertir le CP1252 de Windows en UTF-8 de Unix (Unicode) :
iconv -f CP1252 -t UTF-8 entrée.txt | dos2unix > sortie.txt
Convertir du Latin-1 de Unix au code page par défaut de DOS :
unix2dos -iso -n entrée.txt sortie.txt
Convertir le Latin-1 de Unix en CP850 du DOS :
unix2dos -850 -n entrée.txt sortie.txt
Convertir le Latin-1 de Unix en CP1252 de Windows :
unix2dos -1252 -n entrée.txt sortie.txt
Convertir le UTF-8 de Unix (Unicode) en CP1252 de Windows :
unix2dos < entrée.txt | iconv -f UTF-8 -t CP1252 > sortie.txt
Consultez aussi <http://czyborra.com/charsets/codepages.html> et
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Codages
Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers
sont généralement codés en UTF-8. Sous Windows, les fichiers textes
Unicode peuvent être codés en UTF-8, UTF-16 ou UTF-16 gros boutien mais
ils sont majoritairement codés au format UTF-16.
Conversion
Les fichiers textes Unicode peuvent avoir des sauts de lignes DOS, Unix
ou Mac, tout comme les fichiers textes normaux.
Toutes les versions de dos2unix et unix2dos peuvent convertir des
fichiers codés en UTF-8 car UTF-8 a été conçu pour être rétro-compatible
avec l'ASCII.
Dos2unix et unix2dos, avec le support pour l'Unicode UTF-16, peuvent
lire les fichiers textes codés sous forme petit boutien ou gros boutien.
Pour savoir si dos2unix a été compilé avec le support UTF-16 tapez
"dos2unix -V".
Sous Unix/Linux, les fichiers encodés en UTF-16 sont convertis vers
l'encodage des caractères de la localisation. Utilisez locale(1) pour
découvrir quel encodage de caractères est utilisé. Lorsque la conversion
n'est pas possible, une erreur de conversion est produite et le fichier
est abandonné.
Sous Windows, les fichiers UTF-16 sont convertis par défaut en UTF-8.
Les fichiers textes formatés en UTF-8 sont bien supportés sous Windows
et Unix/Linux.
Les codages UTF-16 et UTF-8 sont parfaitement compatibles. Il n'y a pas
de pertes lors de la conversion. Lorsqu'une erreur de conversion UTF-16
vers UTF-8 survient, par exemple, quand le fichier d'entrée UTF-16
contient une erreur, le fichier est ignoré.
Quand l'option "-u" est utilisée, le fichier de sortie est écrit dans le
même encodage UTF-16 que le fichier d'entrée. L'option "-u" empêche la
conversion en UTF-8.
Dos2unix et unix2dos n'ont pas d'option pour convertir des fichiers
UTF-8 en UTF-16.
Les modes de conversion ISO et 7 bits ne fonctionnent pas sur des
fichiers UTF-16.
Marque d'ordre des octets
Les fichiers textes Unicode sous Windows on généralement un indicateur
d'ordre des octets (BOM) car de nombreux programmes Windows (y compris
Notepad) ajoutent cet indicateur par défaut. Consultez aussi
<http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets>.
Sous Unix, les fichiers Unicodes n'ont habituellement pas de BOM. Il est
supposé que les fichiers textes sont codés selon le codage de
l'environnement linguistique.
Dos2unix ne peut détecter que le fichier est au format UTF-16 si le
fichier n'a pas de BOM. Quand le fichier UTF-16 n'a pas cet indicateur,
dos2unix voit le fichier comme un fichier binaire.
Utilisez l'option "-ul" ou "-ub" pour convertir un fichier UTF-16 sans
BOM.
Dos2unix, par défaut, n'écrit pas de BOM dans le fichier de sortie. Avec
l'option "-b", Dos2unix écrit une BOM quand le fichier d'entrée a une
BOM.
Unix2dos écrit par défaut une BOM dans le fichier de sortie quand le
fichier d'entrée a une BOM. Utilisez l'option "-r" pour supprimer la
BOM.
Dos2unix et unix2dos écrivent toujours une BOM quand l'option "-m" est
utilisée.
Exemples Unicode
Convertir de l'UTF-16 Windows (avec BOM) vers l'UTF-8 de Unix :
dos2unix -n entrée.txt sortie.txt
Convertir de l'UTF-16LE de Windows (sans BOM) vers l'UTF-8 de Unix :
dos2unix -ul -n entrée.txt sortie.txt
Convertir de l'UTF-8 de Unix vers l'UTF-8 de Windows avec BOM :
unix2dos -m -n entrée.txt sortie.txt
Convertir de l'UTF-8 de Unix vers l'UTF-16 de Windows :
unix2dos < entrée.txt | iconv -f UTF-8 -t UTF-16 > sortie.txt
GB18030
GB18030 est un standard du gouvernement chinois. Tout logiciel vendu en
Chine doit officiellement supporter un sous ensemble obligatoire du
standard GB18030. Consultez <http://fr.wikipedia.org/wiki/GB_18030>.
GB18030 est entièrement compatible avec Unicode et peut être considéré
comme étant un format de transformation unicode. Comme UTF-8, GB18030
est compatible avec ASCII. GB18030 est aussi compatible avec le code
page 936 de Windows aussi connu comme GBK.
Sous Unix/Linux, les fichiers UTF-16 sont convertis en GB18030 quand
l'encodage de la localisation est GB18030. Notez que cela ne
fonctionnera que si l'emplacement est en Chine. Autrement dit, dans la
localisation anglaise britannique "en_GB.GB18030", la conversion de
UTF-16 vers GB18030 ne fonctionnera pas mais une localisation chinoise
"zh_CN.GB18030" fonctionnera.
Sous Windows, vous avez besoin de l'option "-gb" pour convertir UTF-16
en GB18030.
Les fichiers encodés en GB18030 peuvent avoir une marque d'ordre des
octets, comme les fichiers Unicode.
EXEMPLES
Lire l'entrée depuis « stdin » et écrire la sortie vers « stdout » :
dos2unix
dos2unix -l -c mac
Convertir et remplacer a.txt. Convertir et remplace b.txt :
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Convertir et remplacer a.txt en mode de conversion ascii :
dos2unix a.txt
Convertir et remplacer a.txt en mode de conversion ascii. Convertir et
remplacer b.txt en mode de conversion 7 bits :
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Convertir a.txt depuis le format Mac vers le format Unix :
dos2unix -c mac a.txt
mac2unix a.txt
Convertir a.txt du format Unix au format Mac :
unix2dos -c mac a.txt
unix2mac a.txt
Convertir et remplacer a.txt tout en conservant la date originale :
dos2unix -k a.txt
dos2unix -k -o a.txt
Convertir a.txt et écrire dans e.txt :
dos2unix -n a.txt e.txt
Convertir a.txt et écrire dans e.txt. La date de e.txt est la même que
celle de a.txt :
dos2unix -k -n a.txt e.txt
Convertir et remplacer a.txt. Convertir b.txt et écrire dans e.txt :
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Convertir c.txt et écrire dans e.txt. Convertir et remplacer a.txt.
Convertir et remplacer b.txt. Convertir d.txt et écrire dans f.txt :
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
CONVERSIONS RÉCURSIVES
Utilisez dos2unix avec les commandes find(1) et xargs(1) pour convertir
récursivement des fichiers textes dans une arborescence de répertoires.
Par exemple, pour convertir tous les fichiers .txt dans les répertoires
sous le répertoire courant, tapez:
find . -name *.txt |xargs dos2unix
PARAMÈTRES LINGUISTIQUES
LANG
La langue principale est sélectionnée par la variable
d'environnement LANG. La variable LANG est composée de plusieurs
parties. La première partie est le code de la langue en minuscules.
La deuxième partie est le code du pays en majuscules précédé d'un
souligné. Elle est facultative. Il y a aussi une troisième partie
facultative qui est le codage des caractères précédé par un point.
Voici quelques exemples pour un shell au standard POSIX:
export LANG=fr Français
export LANG=fr_CA Français, Canada
export LANG=fr_BE Français, Belgique
export LANG=es_ES Espagnol, Espagne
export LANG=es_MX Espagnol, Mexique
export LANG=en_US.iso88591 Anglais, USA, codage Latin-1
export LANG=en_GB.UTF-8 Anglais, UK, codage UTF-8
La liste complète des codes de langues et de pays est dans le manuel
de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
Sur les systèmes Unix, vous pouvez utiliser la commande locale(1)
pour obtenir des informations sur l'environnement linguistique.
LANGUE
Avec la variable d'environnement LANGUAGE, vous pouvez spécifier une
liste de langues prioritaires séparées par des deux-points. Dos2unix
fait passer LANGUAGE avant LANG. Par exemple, pour utiliser le
français avant l'anglais: "LANGUAGE=fr:en". Vous devez d'abord
activer l'environnement linguistique en assignant une valeur autre
que « C » à LANG (ou LC_ALL). Ensuite, vous pourrez utiliser la
liste de priorité avec la variable LANGUAGE. Voyez également le
manuel de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Si vous sélectionnez une langue qui n'est pas disponible, vous
obtiendrez des messages en anglais standard.
DOS2UNIX_LOCALEDIR
Grâce à la variable d'environnement DOS2UNIX_LOCALEDIR, la variable
LOCALEDIR compilée dans l'application peut être remplacée. LOCALEDIR
est utilisée pour trouver les fichiers de langue. La valeur par
défaut de GNU est "/usr/local/share/locale". L'option --version
affiche la valeur de LOCALEDIR utilisée.
Exemple (shell POSIX):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
VALEUR DE RETOUR
Zéro est retourné en cas de succès. Si une erreur système se produit, la
dernière erreur système est retournée. Pour les autres erreurs, 1 est
renvoyé.
La valeur de sortie est toujours zéro en mode silencieux sauf quand de
mauvaises options sont utilisées sur la ligne de commande.
STANDARDS
<http://fr.wikipedia.org/wiki/Fichier_texte>
<http://fr.wikipedia.org/wiki/Retour_chariot>
<http://fr.wikipedia.org/wiki/Fin_de_ligne>
<http://fr.wikipedia.org/wiki/Unicode>
AUTEURS
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mode
mac2unix) - <wuebben@kde.org>, Christian Wurll (ajout de saut de ligne
supplémentaire) - <wurll@ira.uka.de>, Erwin Waterlander -
<waterlan@xs4all.nl> (Mainteneur)
Page du projet: <http://waterlan.home.xs4all.nl/dos2unix.html>
Page SourceForge: <http://sourceforge.net/projects/dos2unix/>
VOIR AUSSI
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - DOS/Mac naar Unix en vice versa tekstbestand formaat omzetter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NAAM">NAAM</a></li>
<li><a href="#OVERZICHT">OVERZICHT</a></li>
<li><a href="#BESCHRIJVING">BESCHRIJVING</a></li>
<li><a href="#OPTIES">OPTIES</a></li>
<li><a href="#MAC-MODUS">MAC-MODUS</a></li>
<li><a href="#CONVERSIEMODI">CONVERSIEMODI</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Coderingen">Coderingen</a></li>
<li><a href="#Conversie">Conversie</a></li>
<li><a href="#Byte-Order-Mark">Byte-Order-Mark</a></li>
<li><a href="#Unicode-voorbeelden">Unicode-voorbeelden</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#VOORBEELDEN">VOORBEELDEN</a></li>
<li><a href="#RECURSIEVE-CONVERSIE">RECURSIEVE CONVERSIE</a></li>
<li><a href="#LOKALISATIE">LOKALISATIE</a></li>
<li><a href="#AFSLUITWAARDE">AFSLUITWAARDE</a></li>
<li><a href="#STANDAARDEN">STANDAARDEN</a></li>
<li><a href="#AUTEURS">AUTEURS</a></li>
<li><a href="#ZIE-OOK">ZIE OOK</a></li>
</ul>
<h1 id="NAAM">NAAM</h1>
<p>dos2unix - omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix en vice versa</p>
<h1 id="OVERZICHT">OVERZICHT</h1>
<pre><code> dos2unix [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...]
unix2dos [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...]</code></pre>
<h1 id="BESCHRIJVING">BESCHRIJVING</h1>
<p>Het Dos2unix pakket bevat de toepassingen <code>dos2unix</code> en <code>unix2dos</code> om platte tekstbestanden in DOS- of Mac-indeling naar Unix-indeling om te zetten, en vice versa.</p>
<p>In DOS/Windows-tekstbestanden bestaat een regeleinde uit een combinatie van twee tekens: een &#39;Carriage Return&#39; (CR) gevolgd door een &#39;Line Feed&#39; (LF). In Unix-tekstbestanden bestaat een regeleinde uit &eacute;&eacute;n enkel &#39;Newline&#39;-teken, dat gelijk is aan een DOS &#39;Line Feed&#39;-teken (LF). In Mac-tekstbestanden, van v&oacute;&oacute;r Mac OS X, bestaan regeleindes uit &eacute;&eacute;n enkel &#39;Carriage Return&#39;-teken. Mac OS X is op Unix gebaseerd en heeft dezelfde regeleindes als Unix.</p>
<p>Naast regeleindes kan Dos2unix ook de codering van bestanden converteren. Enkele DOS-codetabellen kunnen omgezet worden naar Unix Latin-1. En Windows Unicode-bestanden (UTF-16) kunnen geconverteerd worden naar Unix Unicode-bestanden (UTF-8).</p>
<p>Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting geforceerd wordt.</p>
<p>Niet-reguliere bestanden, zoals mappen en FIFO&#39;s, worden automatisch overgeslagen.</p>
<p>Symbolische koppelingen en hun doelen blijven standaard onaangeroerd. Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer kan naar het doel van de symbolische koppeling worden geschreven. Op Windows wordt het schrijven naar het doel van een symbolische koppeling niet ondersteund.</p>
<p>Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is &eacute;&eacute;n belangrijk verschil: deze versie van dos2unix voert standaard een vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke SunOS/Solaris-versie alleen de gepaarde conversie (nieuw-bestand-modus) kent. Zie ook de opties <code>-o</code> en <code>-n</code>.</p>
<h1 id="OPTIES">OPTIES</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Alle volgende opties als bestandsnamen behandelen. Gebruik deze optie als u een bestand wilt converteren waarvan de naam met een streepje begint. Bijvoorbeeld, om een bestand genaamd &quot;-foo&quot; om te zetten, gebruikt u de volgende opdracht:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>Of in nieuw-bestand-modus:</p>
<pre><code> dos2unix -n -- -foo uit.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>Alleen regeleindes converteren. Dit is de standaardconversiemodus.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Conversie tussen de tekensets DOS en ISO-8859-1. Zie ook de sectie CONVERSIEMODI.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>Windows-codetabel 1252 (West-Europees) gebruiken.</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>DOS-codetabel 437 (VS) gebruiken. Dit is de standaard codetabel die gebruikt wordt bij ISO-conversie.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>DOS-codetabel 850 (West-Europees) gebruiken.</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>DOS-codetabel 860 (Portugees) gebruiken.</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>DOS-codetabel 863 (Canadees Frans) gebruiken.</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>DOS-codetabel 865 (Scandinavisch) gebruiken.</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Lettertekens met het achtste bit gezet converteren naar spaties.</p>
</dd>
<dt id="b---keep-bom"><b>-b</b>, <b>--keep-bom</b></dt>
<dd>
<p>Een Byte-Order-Mark (BOM) behouden. Als het invoerbestand een BOM bevat, dan wordt ook een BOM naar het uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar DOS. Zie ook optie <code>-r</code>.</p>
</dd>
<dt id="c---convmode-CONVERSIEMODUS"><b>-c</b>, <b>--convmode CONVERSIEMODUS</b></dt>
<dd>
<p>De te gebruiken conversiemodus. CONVERSIEMODUS kan zijn: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, of <i>mac</i>, waarbij ascii de standaardinstelling is.</p>
</dd>
<dt id="f---force"><b>-f</b>, <b>--force</b></dt>
<dd>
<p>Conversie van binaire bestanden afdwingen.</p>
</dd>
<dt id="gb---gb18030"><b>-gb</b>, <b>--gb18030</b></dt>
<dd>
<p>Op Windows worden UTF-16-bestanden standaard naar UTF-8 geconverteerd, ongeacht de ingestelde taalregio. Gebruik deze optie om UTF-16-bestanden naar GB18030 te converteren. Deze optie is alleen beschikbaar op Windows. Zie ook de sectie <b>GB18030</b>.</p>
</dd>
<dt id="h---help"><b>-h</b>, <b>--help</b></dt>
<dd>
<p>Een hulptekst tonen.</p>
</dd>
<dt id="i-VLAGGEN---info-VLAGGEN-BESTAND"><b>-i</b>[<b>VLAGGEN</b>], <b>--info</b>[<b>=VLAGGEN</b>] <b>BESTAND</b>...</dt>
<dd>
<p>Bestandsinformatie tonen. Er wordt niets geconverteerd.</p>
<p>De volgende informatie wordt weergegeven, in deze volgorde: het aantal DOS-regeleindes, het aantal Unix-regeleindes, het aantal Mac-regeleindes, de Byte-Order-Mark, of het een tekst- of binair bestand is, en de bestandsnaam.</p>
<p>Voorbeelduitvoer:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Bij de optie kunnen &eacute;&eacute;n of meer vlaggen meegegeven worden om de uitvoer te beperken.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Het aantal DOS-regeleindes tonen.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Het aantal Unix-regeleindes tonen.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Het aantal Mac-regeleindes tonen.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>De Byte-Order-Mark tonen.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Tonen of het bestand tekst is of binair.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Alleen de namen tonen van de bestanden die geconverteerd zouden worden.</p>
<p>Met de vlag <code>c</code> toont dos2unix alleen de bestanden die DOS-regeleindes bevatten, en unix2dos alleen de bestanden die Unix-regeleindes bevatten.</p>
</dd>
</dl>
<p>Voorbeelden:</p>
<p>Informatie weergeven voor alle bestanden met de extensie &#39;txt&#39;:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Alleen de Byte-Order-Mark tonen:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>De bestanden opsommen die DOS-regeleindes bevatten:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>De bestanden opsommen die Unix-regeleindes bevatten:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k</b>, <b>--keepdate</b></dt>
<dd>
<p>Het tijdsstempel van het invoerbestand behouden voor het uitvoerbestand.</p>
</dd>
<dt id="L---license"><b>-L</b>, <b>--license</b></dt>
<dd>
<p>De softwarelicentie tonen.</p>
</dd>
<dt id="l---newline"><b>-l</b>, <b>--newline</b></dt>
<dd>
<p>Een extra regeleinde toevoegen.</p>
<p><b>dos2unix</b>: Alleen DOS-regeleindes worden omgezet naar twee Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet naar twee Unix-regeleindes.</p>
<p><b>unix2dos</b>: Alleen Unix-regeleindes worden omgezet naar twee DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar twee Mac-regeleindes.</p>
</dd>
<dt id="m---add-bom"><b>-m</b>, <b>--add-bom</b></dt>
<dd>
<p>Een Byte-Order-Mark (BOM) naar het uitvoerbestand schrijven. Standaard wordt een UTF-8-BOM geschreven.</p>
<p>Als het invoerbestand in UTF-16 is, en de optie <code>-u</code> is gegeven, dan wordt een UTF-16-BOM geschreven.</p>
<p>Gebruik deze optie nooit als de codering van het uitvoerbestand niet UTF-8 of UTF-16 is. Zie ook de sectie UNICODE.</p>
</dd>
<dt id="n---newfile-INVOERBESTAND-UITVOERBESTAND"><b>-n</b>, <b>--newfile INVOERBESTAND UITVOERBESTAND</b> ...</dt>
<dd>
<p>Nieuw-bestand-modus. Het bestand INVOERBESTAND converteren en naar bestand UITVOERBESTAND schrijven. Bestandsnamen moeten opgegeven worden in paren. Jokertekens moeten <i>niet</i>gebruikt worden, anders <i>verlies</i> je de bestanden.</p>
<p>De gebruiker die de conversie start in nieuw-bestand (gepaarde) modus wordt de eigenaar van het geconverteerde bestand. De lees/schrijf-toegangsrechten van het nieuwe bestand worden de toegangsrechten van het originele bestand minus de umask(1) van de gebruiker die de conversie draait.</p>
</dd>
<dt id="o---oldfile-BESTAND"><b>-o</b>, <b>--oldfile BESTAND</b> ...</dt>
<dd>
<p>Oud-bestand-modus. Het bestand BESTAND converteren en overschrijven. Dit is de standaard modus. Jokertekens kunnen gebruikt worden.</p>
<p>In oud-bestand (vervangende) modus krijgt het geconverteerde bestand dezelfde eigenaar, groep en lees/schrijf-rechten als het originele bestand. Ook wanneer het bestand wordt omgezet door een andere gebruiker die schrijfrechten heeft op het bestand (b.v. gebruiker root). De omzetting wordt afgebroken wanneer het niet mogelijk is de originele waardes te behouden. Verandering van eigenaar kan betekenen dat de originele eigenaar het bestand niet meer kan lezen. Verandering van groep zou een veiligheidsrisico kunnen zijn, het bestand zou leesbaar kunnen worden voor personen voor wie het niet bestemd is. Behoud van eigenaar, groep en lees/schrijf-rechten wordt alleen ondersteund op Unix.</p>
</dd>
<dt id="q---quiet"><b>-q</b>, <b>--quiet</b></dt>
<dd>
<p>Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde is nul, behalve wanneer verkeerde opties worden gegeven.</p>
</dd>
<dt id="r---remove-bom"><b>-r</b>, <b>--remove-bom</b></dt>
<dd>
<p>Een Byte-Order-Mark (BOM) verwijderen. Er wordt geen BOM naar het uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar Unix. Zie ook optie <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s</b>, <b>--safe</b></dt>
<dd>
<p>Binaire bestanden overslaan (standaard).</p>
</dd>
<dt id="u---keep-utf16"><b>-u</b>, <b>--keep-utf16</b></dt>
<dd>
<p>De originele UTF-16-codering van het invoerbestand behouden. Het uitvoerbestand wordt in dezelfde UTF-16-codering (little endian of big endian) geschreven als het invoerbestand. Dit voorkomt conversie naar UTF-8. Er wordt ook een corresponderende UTF-16-BOM geschreven. Deze optie kan uitgeschakeld worden met de optie <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul</b>, <b>--assume-utf16le</b></dt>
<dd>
<p>Veronderstellen dat de indeling van het invoerbestand UTF-16LE is.</p>
<p>Wanneer het invoerbestand een Byte-Order-Mark (BOM) bevat, dan gaat deze BOM v&oacute;&oacute;r deze optie.</p>
<p>Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen UTF-16LE) en de conversie verliep met succes, dan krijgt u een UTF-8-bestand met verkeerde tekst. De verkeerde conversie kan ongedaan worden gemaakt door met iconv(1) het UTF-8-uitvoerbestand terug om te zetten naar UTF-16LE. Dit zal het originele bestand terug brengen.</p>
<p>De aanname van UTF-16LE werkt als een <i>conversiemodus</i>. Door de standaardmodus <i>ascii</i> in te schakelen wordt de UTF-16LE-veronderstelling uitgeschakeld.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub</b>, <b>--assume-utf16be</b></dt>
<dd>
<p>Veronderstellen dat de indeling van het invoerbestand UTF-16BE is.</p>
<p>Deze optie werkt hetzelfde als optie <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v</b>, <b>--verbose</b></dt>
<dd>
<p>Extra meldingen weergeven. Er wordt extra informatie getoond over Byte-Order-Marks en het aantal geconverteerde regeleindes.</p>
</dd>
<dt id="F---follow-symlink"><b>-F</b>, <b>--follow-symlink</b></dt>
<dd>
<p>Symbolische koppelingen volgen en de doelen converteren.</p>
</dd>
<dt id="R---replace-symlink"><b>-R</b>, <b>--replace-symlink</b></dt>
<dd>
<p>Symbolische koppelingen vervangen door geconverteerde bestanden (de originele doelbestanden blijven ongewijzigd).</p>
</dd>
<dt id="S---skip-symlink"><b>-S</b>, <b>--skip-symlink</b></dt>
<dd>
<p>Symbolische koppelingen en doelen ongewijzigd laten (standaard).</p>
</dd>
<dt id="V---version"><b>-V</b>, <b>--version</b></dt>
<dd>
<p>Versie-informatie tonen.</p>
</dd>
</dl>
<h1 id="MAC-MODUS">MAC-MODUS</h1>
<p>In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa. Mac-regeleindes worden niet omgezet.</p>
<p>In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa. DOS-regeleindes blijven ongewijzigd.</p>
<p>Om in Mac-modus te draaien kunt u de opdrachtregeloptie <code>-c mac</code> gebruiken, of de opdrachten <code>mac2unix</code> of <code>unix2mac</code>.</p>
<h1 id="CONVERSIEMODI">CONVERSIEMODI</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>In modus <code>ascii</code> worden alleen regeleindes omgezet. Dit is de standaardmodus.</p>
<p>Hoewel de naam van deze modus ASCII is, wat een 7-bits standaard is, is de werkelijke modus 8-bits. Gebruik altijd deze modus wanneer u Unicode UTF-8-bestanden omzet.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>Alle 8-bits niet-ASCII lettertekens (met waardes van 128 t/m 255) worden omgezet naar een 7-bits spatie.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de ISO-tekenset ISO-8859-1 (Latin-1) op Unix. DOS-tekens zonder een ISO-8859-1-equivalent, waarvoor dus geen omzetting mogelijk is, worden omgezet in een punt. Hetzelfde geldt voor ISO-8859-1-tekens zonder DOS-tegenhanger.</p>
<p>Wanneer alleen optie <code>-iso</code> gebruikt wordt, zal dos2unix proberen de actieve codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel CP437 gebruikt, die vooral in de VS gebruikt wordt. Om een bepaalde codetabel te forceren, kunt u de opties <code>-850</code> (West-Europees), <code>-860</code> (Portugees), <code>-863</code> (Canadees Frans) of <code>-865</code> (Scandinavisch) gebruiken. Windows-codetabel CP1252 (West-Europees) wordt ook ondersteund met optie <code>-1252</code>. Gebruik voor andere codetabellen dos2unix in combinatie met iconv(1). Iconv kan omzetten tussen een lange lijst tekensetcoderingen.</p>
<p>Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal UTF-8-gecodeerde bestanden beschadigen.</p>
<p>Enkele voorbeelden:</p>
<p>Omzetten van de standaard DOS-codetabel naar Unix Latin-1:</p>
<pre><code> dos2unix -iso -n in.txt uit.txt</code></pre>
<p>Omzetten van DOS CP850 naar Unix Latin-1:</p>
<pre><code> dos2unix -850 -n in.txt uit.txt</code></pre>
<p>Omzetten van Windows CP1252 naar Unix Latin-1:</p>
<pre><code> dos2unix -1252 -n in.txt uit.txt</code></pre>
<p>Omzetten van Windows CP1252 naar Unix UTF-8 (Unicode):</p>
<pre><code> iconv -f CP1252 -t UTF-8 in.txt | dos2unix &gt; uit.txt</code></pre>
<p>Omzetten van Unix Latin-1 naar de standaard DOS-codetabel:</p>
<pre><code> unix2dos -iso -n in.txt uit.txt</code></pre>
<p>Omzetten van Unix Latin-1 naar DOS CP850:</p>
<pre><code> unix2dos -850 -n in.txt uit.txt</code></pre>
<p>Omzetten van Unix Latin-1 naar Windows CP1252:</p>
<pre><code> unix2dos -1252 -n in.txt uit.txt</code></pre>
<p>Omzetten van Unix UTF-8 (Unicode) naar Windows CP1252:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t CP1252 &gt; uit.txt</code></pre>
<p>Zie ook <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> en <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Coderingen">Coderingen</h2>
<p>Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn Unicode-bestanden typisch gecodeerd in UTF-8. Op Windows kunnen Unicode-tekstbestanden gecodeerd zijn in UTF-8, UTF-16 of UTF-16 big endian, maar ze zijn meestal gecodeerd in UTF-16.</p>
<h2 id="Conversie">Conversie</h2>
<p>Unicode-tekstbestanden kunnen DOS-, Unix- of Mac-regeleindes hebben, net als reguliere tekstbestanden.</p>
<p>Alle versies van dos2unix en unix2dos kunnen UTF-8-gecodeerde bestanden omzetten, want UTF-8 is ontworpen op compatibiliteit met ASCII.</p>
<p>Dos2unix en unix2dos met Unicode UTF-16-ondersteuning kunnen little en big endian UTF-16-gecodeerde tekstbestanden lezen. Om er achter te komen of dos2unix gebouwd is met UTF-16- ondersteuning, typt u <code>dos2unix -V</code>.</p>
<p>Op Unix/Linux worden UTF-16-bestanden geconverteerd naar de codering van de ingestelde taalregio. Gebruik de opdracht <b>locale</b>(1) om te zien wat de ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er een fout op en wordt het bestand overgeslagen.</p>
<p>Op Windows worden UTF-16-bestanden standaard naar UTF-8 geconverteerd. UTF-8-tekstbestanden worden alom goed ondersteund, zowel op Windows als Unix/Linux.</p>
<p>De UTF-16- en UTF-8-coderingen zijn volledig compatibel, er gaat bij het converteren niets verloren. Als er tijdens de conversie van UTF-16 naar UTF-8 een fout optreedt, bijvoorbeeld omdat het UTF-16-invoerbestand een fout bevat, dan wordt het bestand overgeslagen.</p>
<p>Wanneer <code>-u</code> gebruikt wordt, wordt het uitvoerbestand in dezelfde UTF-16-codering geschreven als het invoerbestand. Optie <code>-u</code> voorkomt conversie naar UTF-8.</p>
<p>Dos2unix en unix2dos hebben geen optie om van UTF-8 naar UTF-16 te converteren.</p>
<p>ISO- en 7-bits-conversie werken niet op UTF-16-bestanden.</p>
<h2 id="Byte-Order-Mark">Byte-Order-Mark</h2>
<p>Op Windows bevatten Unicode-tekstbestanden gewoonlijk een Byte-Order-Mark (BOM), omdat veel Windows-programma&#39;s (inclusief Kladblok) standaard een BOM toevoegen. Zie ook <a href="http://en.wikipedia.org/wiki/Byte_order_mark">http://en.wikipedia.org/wiki/Byte_order_mark</a>.</p>
<p>Op Unix hebben Unicode-tekstbestanden meestal geen BOM. Er wordt aangenomen dat de codering van tekstbestanden gelijk is aan de tekencodering van de ingestelde taalregio.</p>
<p>Dos2unix kan alleen detecteren of een bestand in UTF-16-codering is als het bestand een BOM bevat. Wanneer een UTF-16-bestand geen BOM heeft, ziet dos2unix het bestand als een binair bestand.</p>
<p>Gebruik optie <code>-ul</code> of <code>-ub</code> om een UTF-16-bestand zonder BOM om te zetten.</p>
<p>Dos2unix schrijft standaard geen BOM in het uitvoerbestand. Met optie <code>-b</code> schrijft dos2unix een BOM wanneer het invoerbestand een BOM bevat.</p>
<p>Unix2dos schrijft standaard een BOM in het uitvoerbestand wanneer het invoerbestand een BOM bevat. Gebruik optie <code>-r</code> om de BOM te verwijderen.</p>
<p>Dos2unix en unix2dos schrijven altijd een BOM wanneer optie <code>-m</code> gebruikt wordt.</p>
<h2 id="Unicode-voorbeelden">Unicode-voorbeelden</h2>
<p>Omzetten van Windows UTF-16 (met BOM) naar Unix UTF-8:</p>
<pre><code> dos2unix -n in.txt uit.txt</code></pre>
<p>Omzetten van Windows UTF-16LE (zonder BOM) naar Unix UTF-8:</p>
<pre><code> dos2unix -ul -n in.txt uit.txt</code></pre>
<p>Omzetten van Unix UTF-8 naar Windows UTF-8 met BOM:</p>
<pre><code> unix2dos -m -n in.txt uit.txt</code></pre>
<p>Omzetten van Unix UTF-8 naar Windows UTF-16:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t UTF-16 &gt; uit.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 is een standaard van de Chinese overheid. Een subset van de GB18030-standaard is officieel verplicht voor alle softwareproducten die in China verkocht worden. Zie ook <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 is volledig compatibel met Unicode, en kan als een Unicodetransformatie beschouwd worden. Net als UTF-8 is GB18030 compatibel met ASCII. GB18030 is ook compatibel met Windows-codetabel 936 (ook wel GBK genoemd).</p>
<p>Op Unix/Linux worden UTF-16-bestanden alleen naar GB18030 geconverteerd wanneer de taalregio op China ingesteld is en de codering op GB18030. Bijvoorbeeld, met de Britse taalregio-instelling <code>en_GB.GB18030</code> zal conversie van UTF-16 naar GB18030 niet werken, maar met de Chinese instelling <code>zh_CN.GB18030</code> wel.</p>
<p>Op Windows dient u de optie <code>-gb</code> te gebruiken om UTF-16-bestanden naar GB18030 te converteren.</p>
<p>GB18030-bestanden kunnen een Byte-Order-Mark bevatten, net als Unicode-bestanden.</p>
<h1 id="VOORBEELDEN">VOORBEELDEN</h1>
<p>Invoer lezen van standaardinvoer en uitvoer schrijven naar standaarduitvoer:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Omzetten en vervangen van a.txt in ascii-conversiemodus:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en vervangen van b.txt in 7-bits conversiemodus:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Omzetten van a.txt van Mac- naar Unix-indeling:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Omzetten van a.txt van Unix- naar Mac-indeling:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Omzetten van a.txt en resultaat naar e.txt schrijven:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt gelijk aan die van a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt schrijven:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van a.txt; omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt schrijven.</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="RECURSIEVE-CONVERSIE">RECURSIEVE CONVERSIE</h1>
<p>Gebruik dos2unix in combinatie met de opdrachten <b>find</b>(1) en <b>xargs</b>(1) om tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om alle .txt-bestanden in de mappenboom onder de huidige map te converteren, typt u:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="LOKALISATIE">LOKALISATIE</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>De primaire taal wordt geselecteerd via de omgevingsvariabele LANG. De variabele LANG bestaat uit verschillende onderdelen. Het eerste deel is in kleine letters de taalcode. Het tweede deel is optioneel en is de landcode in hoofdletters, voorafgegaan door een liggend streepje. Er is ook een optioneel derde deel: de tekencodering, voorafgegaan door een punt. Enkele voorbeelden voor een POSIX-shell:</p>
<pre><code> export LANG=nl Nederlands
export LANG=nl_NL Nederlands, Nederland
export LANG=nl_BE Nederlands, Belgi&euml;
export LANG=es_ES Spaans, Spanje
export LANG=es_MX Spaans, Mexico
export LANG=en_US.iso88591 Engels, VS, Latin-1-codering
export LANG=en_GB.UTF-8 Engels, GB, UTF-8-codering</code></pre>
<p>Voor een complete lijst van taal- en landcodes zie de gettext-handleiding: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>Op Unix-systemen kunt u de opdracht <b>locale</b>(1) gebruiken om specifieke taalregio-informatie te verkrijgen.</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>Met de omgevingsvariabele LANGUAGE kunt u een prioriteitenlijst specificeren van talen, gescheiden door dubbele punten. Dos2unix geeft voorrang aan LANGUAGE boven LANG. Bijvoorbeeld, eerst Nederlands en dan Duits: <code>LANGUAGE=nl:de</code>. U moet eerst lokalisatie in werking stellen, door het instellen van LANG (of LC_ALL) op een waarde ongelijk aan &quot;C&quot;, voordat u een talen-prioriteitenlijst kunt gebruiken via de variabele LANGUAGE. Zie ook de gettext-handleiding: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>Als u een taal kiest die niet beschikbaar is, worden de standaard Engelse berichten gebruikt.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Met de omgevingsvariabele DOS2UNIX_LOCALEDIR kan de LOCALEDIR die ingesteld werd tijdens compilatie worden overstemd. LOCALEDIR wordt gebruikt om de taalbestanden te vinden. De GNU standaardwaarde is <code>/usr/local/share/locale</code>. De optie <b>--version</b> laat de gebruikte LOCALEDIR zien.</p>
<p>Voorbeeld (POSIX-shell):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="AFSLUITWAARDE">AFSLUITWAARDE</h1>
<p>Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt wordt het laatste systeemfoutnummer teruggegeven. Bij andere fouten wordt 1 teruggegeven.</p>
<p>De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve wanneer verkeerde opties worden gegeven.</p>
<h1 id="STANDAARDEN">STANDAARDEN</h1>
<p><a href="http://nl.wikipedia.org/wiki/Tekstbestand">http://nl.wikipedia.org/wiki/Tekstbestand</a></p>
<p><a href="http://nl.wikipedia.org/wiki/Carriage_Return">http://nl.wikipedia.org/wiki/Carriage_Return</a></p>
<p><a href="http://nl.wikipedia.org/wiki/Linefeed">http://nl.wikipedia.org/wiki/Linefeed</a></p>
<p>&lt;http://nl.wikipedia.org/wiki/Unicode&gt;</p>
<h1 id="AUTEURS">AUTEURS</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (mac2unix-modus) - &lt;wuebben@kde.org&gt;, Christian Wurll (toevoegen van extra regeleindes) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (beheerder)</p>
<p>Projectpagina: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>SourceForge-pagina: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="ZIE-OOK">ZIE OOK</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,614 +0,0 @@
NAAM
dos2unix - omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix
en vice versa
OVERZICHT
dos2unix [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...]
unix2dos [opties] [BESTAND ...] [-n INVOERBESTAND UITVOERBESTAND ...]
BESCHRIJVING
Het Dos2unix pakket bevat de toepassingen "dos2unix" en "unix2dos" om
platte tekstbestanden in DOS- of Mac-indeling naar Unix-indeling om te
zetten, en vice versa.
In DOS/Windows-tekstbestanden bestaat een regeleinde uit een combinatie
van twee tekens: een 'Carriage Return' (CR) gevolgd door een 'Line Feed'
(LF). In Unix-tekstbestanden bestaat een regeleinde uit één enkel
'Newline'-teken, dat gelijk is aan een DOS 'Line Feed'-teken (LF). In
Mac-tekstbestanden, van vóór Mac OS X, bestaan regeleindes uit één enkel
'Carriage Return'-teken. Mac OS X is op Unix gebaseerd en heeft dezelfde
regeleindes als Unix.
Naast regeleindes kan Dos2unix ook de codering van bestanden
converteren. Enkele DOS-codetabellen kunnen omgezet worden naar Unix
Latin-1. En Windows Unicode-bestanden (UTF-16) kunnen geconverteerd
worden naar Unix Unicode-bestanden (UTF-8).
Binaire bestanden worden automatisch overgeslagen, behalve als de
omzetting geforceerd wordt.
Niet-reguliere bestanden, zoals mappen en FIFO's, worden automatisch
overgeslagen.
Symbolische koppelingen en hun doelen blijven standaard onaangeroerd.
Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer
kan naar het doel van de symbolische koppeling worden geschreven. Op
Windows wordt het schrijven naar het doel van een symbolische koppeling
niet ondersteund.
Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is één
belangrijk verschil: deze versie van dos2unix voert standaard een
vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke
SunOS/Solaris-versie alleen de gepaarde conversie (nieuw-bestand-modus)
kent. Zie ook de opties "-o" en "-n".
OPTIES
-- Alle volgende opties als bestandsnamen behandelen. Gebruik deze
optie als u een bestand wilt converteren waarvan de naam met een
streepje begint. Bijvoorbeeld, om een bestand genaamd "-foo" om te
zetten, gebruikt u de volgende opdracht:
dos2unix -- -foo
Of in nieuw-bestand-modus:
dos2unix -n -- -foo uit.txt
-ascii
Alleen regeleindes converteren. Dit is de standaardconversiemodus.
-iso
Conversie tussen de tekensets DOS en ISO-8859-1. Zie ook de sectie
CONVERSIEMODI.
-1252
Windows-codetabel 1252 (West-Europees) gebruiken.
-437
DOS-codetabel 437 (VS) gebruiken. Dit is de standaard codetabel die
gebruikt wordt bij ISO-conversie.
-850
DOS-codetabel 850 (West-Europees) gebruiken.
-860
DOS-codetabel 860 (Portugees) gebruiken.
-863
DOS-codetabel 863 (Canadees Frans) gebruiken.
-865
DOS-codetabel 865 (Scandinavisch) gebruiken.
-7 Lettertekens met het achtste bit gezet converteren naar spaties.
-b, --keep-bom
Een Byte-Order-Mark (BOM) behouden. Als het invoerbestand een BOM
bevat, dan wordt ook een BOM naar het uitvoerbestand geschreven. Dit
is het standaardgedrag bij conversie naar DOS. Zie ook optie "-r".
-c, --convmode CONVERSIEMODUS
De te gebruiken conversiemodus. CONVERSIEMODUS kan zijn: *ascii*,
*7bit*, *iso*, of *mac*, waarbij ascii de standaardinstelling is.
-f, --force
Conversie van binaire bestanden afdwingen.
-gb, --gb18030
Op Windows worden UTF-16-bestanden standaard naar UTF-8
geconverteerd, ongeacht de ingestelde taalregio. Gebruik deze optie
om UTF-16-bestanden naar GB18030 te converteren. Deze optie is
alleen beschikbaar op Windows. Zie ook de sectie GB18030.
-h, --help
Een hulptekst tonen.
-i[VLAGGEN], --info[=VLAGGEN] BESTAND...
Bestandsinformatie tonen. Er wordt niets geconverteerd.
De volgende informatie wordt weergegeven, in deze volgorde: het
aantal DOS-regeleindes, het aantal Unix-regeleindes, het aantal
Mac-regeleindes, de Byte-Order-Mark, of het een tekst- of binair
bestand is, en de bestandsnaam.
Voorbeelduitvoer:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Bij de optie kunnen één of meer vlaggen meegegeven worden om de
uitvoer te beperken.
d Het aantal DOS-regeleindes tonen.
u Het aantal Unix-regeleindes tonen.
m Het aantal Mac-regeleindes tonen.
b De Byte-Order-Mark tonen.
t Tonen of het bestand tekst is of binair.
c Alleen de namen tonen van de bestanden die geconverteerd zouden
worden.
Met de vlag "c" toont dos2unix alleen de bestanden die
DOS-regeleindes bevatten, en unix2dos alleen de bestanden die
Unix-regeleindes bevatten.
Voorbeelden:
Informatie weergeven voor alle bestanden met de extensie 'txt':
dos2unix -i *.txt
Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:
dos2unix -idu *.txt
Alleen de Byte-Order-Mark tonen:
dos2unix --info=b *.txt
De bestanden opsommen die DOS-regeleindes bevatten:
dos2unix -ic *.txt
De bestanden opsommen die Unix-regeleindes bevatten:
unix2dos -ic *.txt
-k, --keepdate
Het tijdsstempel van het invoerbestand behouden voor het
uitvoerbestand.
-L, --license
De softwarelicentie tonen.
-l, --newline
Een extra regeleinde toevoegen.
dos2unix: Alleen DOS-regeleindes worden omgezet naar twee
Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet
naar twee Unix-regeleindes.
unix2dos: Alleen Unix-regeleindes worden omgezet naar twee
DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar
twee Mac-regeleindes.
-m, --add-bom
Een Byte-Order-Mark (BOM) naar het uitvoerbestand schrijven.
Standaard wordt een UTF-8-BOM geschreven.
Als het invoerbestand in UTF-16 is, en de optie "-u" is gegeven, dan
wordt een UTF-16-BOM geschreven.
Gebruik deze optie nooit als de codering van het uitvoerbestand niet
UTF-8 of UTF-16 is. Zie ook de sectie UNICODE.
-n, --newfile INVOERBESTAND UITVOERBESTAND ...
Nieuw-bestand-modus. Het bestand INVOERBESTAND converteren en naar
bestand UITVOERBESTAND schrijven. Bestandsnamen moeten opgegeven
worden in paren. Jokertekens moeten *niet*gebruikt worden, anders
*verlies* je de bestanden.
De gebruiker die de conversie start in nieuw-bestand (gepaarde)
modus wordt de eigenaar van het geconverteerde bestand. De
lees/schrijf-toegangsrechten van het nieuwe bestand worden de
toegangsrechten van het originele bestand minus de umask(1) van de
gebruiker die de conversie draait.
-o, --oldfile BESTAND ...
Oud-bestand-modus. Het bestand BESTAND converteren en overschrijven.
Dit is de standaard modus. Jokertekens kunnen gebruikt worden.
In oud-bestand (vervangende) modus krijgt het geconverteerde bestand
dezelfde eigenaar, groep en lees/schrijf-rechten als het originele
bestand. Ook wanneer het bestand wordt omgezet door een andere
gebruiker die schrijfrechten heeft op het bestand (b.v. gebruiker
root). De omzetting wordt afgebroken wanneer het niet mogelijk is de
originele waardes te behouden. Verandering van eigenaar kan
betekenen dat de originele eigenaar het bestand niet meer kan lezen.
Verandering van groep zou een veiligheidsrisico kunnen zijn, het
bestand zou leesbaar kunnen worden voor personen voor wie het niet
bestemd is. Behoud van eigenaar, groep en lees/schrijf-rechten wordt
alleen ondersteund op Unix.
-q, --quiet
Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde
is nul, behalve wanneer verkeerde opties worden gegeven.
-r, --remove-bom
Een Byte-Order-Mark (BOM) verwijderen. Er wordt geen BOM naar het
uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie
naar Unix. Zie ook optie "-b".
-s, --safe
Binaire bestanden overslaan (standaard).
-u, --keep-utf16
De originele UTF-16-codering van het invoerbestand behouden. Het
uitvoerbestand wordt in dezelfde UTF-16-codering (little endian of
big endian) geschreven als het invoerbestand. Dit voorkomt conversie
naar UTF-8. Er wordt ook een corresponderende UTF-16-BOM geschreven.
Deze optie kan uitgeschakeld worden met de optie "-ascii".
-ul, --assume-utf16le
Veronderstellen dat de indeling van het invoerbestand UTF-16LE is.
Wanneer het invoerbestand een Byte-Order-Mark (BOM) bevat, dan gaat
deze BOM vóór deze optie.
Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen
UTF-16LE) en de conversie verliep met succes, dan krijgt u een
UTF-8-bestand met verkeerde tekst. De verkeerde conversie kan
ongedaan worden gemaakt door met iconv(1) het UTF-8-uitvoerbestand
terug om te zetten naar UTF-16LE. Dit zal het originele bestand
terug brengen.
De aanname van UTF-16LE werkt als een *conversiemodus*. Door de
standaardmodus *ascii* in te schakelen wordt de
UTF-16LE-veronderstelling uitgeschakeld.
-ub, --assume-utf16be
Veronderstellen dat de indeling van het invoerbestand UTF-16BE is.
Deze optie werkt hetzelfde als optie "-ul".
-v, --verbose
Extra meldingen weergeven. Er wordt extra informatie getoond over
Byte-Order-Marks en het aantal geconverteerde regeleindes.
-F, --follow-symlink
Symbolische koppelingen volgen en de doelen converteren.
-R, --replace-symlink
Symbolische koppelingen vervangen door geconverteerde bestanden (de
originele doelbestanden blijven ongewijzigd).
-S, --skip-symlink
Symbolische koppelingen en doelen ongewijzigd laten (standaard).
-V, --version
Versie-informatie tonen.
MAC-MODUS
In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa.
Mac-regeleindes worden niet omgezet.
In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa.
DOS-regeleindes blijven ongewijzigd.
Om in Mac-modus te draaien kunt u de opdrachtregeloptie "-c mac"
gebruiken, of de opdrachten "mac2unix" of "unix2mac".
CONVERSIEMODI
ascii
In modus "ascii" worden alleen regeleindes omgezet. Dit is de
standaardmodus.
Hoewel de naam van deze modus ASCII is, wat een 7-bits standaard is,
is de werkelijke modus 8-bits. Gebruik altijd deze modus wanneer u
Unicode UTF-8-bestanden omzet.
7bit
Alle 8-bits niet-ASCII lettertekens (met waardes van 128 t/m 255)
worden omgezet naar een 7-bits spatie.
iso Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de
ISO-tekenset ISO-8859-1 (Latin-1) op Unix. DOS-tekens zonder een
ISO-8859-1-equivalent, waarvoor dus geen omzetting mogelijk is,
worden omgezet in een punt. Hetzelfde geldt voor ISO-8859-1-tekens
zonder DOS-tegenhanger.
Wanneer alleen optie "-iso" gebruikt wordt, zal dos2unix proberen de
actieve codetabel te gebruiken. Als dat niet mogelijk is wordt
codetabel CP437 gebruikt, die vooral in de VS gebruikt wordt. Om een
bepaalde codetabel te forceren, kunt u de opties -850
(West-Europees), -860 (Portugees), -863 (Canadees Frans) of -865
(Scandinavisch) gebruiken. Windows-codetabel CP1252 (West-Europees)
wordt ook ondersteund met optie -1252. Gebruik voor andere
codetabellen dos2unix in combinatie met iconv(1). Iconv kan omzetten
tussen een lange lijst tekensetcoderingen.
Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal
UTF-8-gecodeerde bestanden beschadigen.
Enkele voorbeelden:
Omzetten van de standaard DOS-codetabel naar Unix Latin-1:
dos2unix -iso -n in.txt uit.txt
Omzetten van DOS CP850 naar Unix Latin-1:
dos2unix -850 -n in.txt uit.txt
Omzetten van Windows CP1252 naar Unix Latin-1:
dos2unix -1252 -n in.txt uit.txt
Omzetten van Windows CP1252 naar Unix UTF-8 (Unicode):
iconv -f CP1252 -t UTF-8 in.txt | dos2unix > uit.txt
Omzetten van Unix Latin-1 naar de standaard DOS-codetabel:
unix2dos -iso -n in.txt uit.txt
Omzetten van Unix Latin-1 naar DOS CP850:
unix2dos -850 -n in.txt uit.txt
Omzetten van Unix Latin-1 naar Windows CP1252:
unix2dos -1252 -n in.txt uit.txt
Omzetten van Unix UTF-8 (Unicode) naar Windows CP1252:
unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > uit.txt
Zie ook <http://czyborra.com/charsets/codepages.html> en
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Coderingen
Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn
Unicode-bestanden typisch gecodeerd in UTF-8. Op Windows kunnen
Unicode-tekstbestanden gecodeerd zijn in UTF-8, UTF-16 of UTF-16 big
endian, maar ze zijn meestal gecodeerd in UTF-16.
Conversie
Unicode-tekstbestanden kunnen DOS-, Unix- of Mac-regeleindes hebben, net
als reguliere tekstbestanden.
Alle versies van dos2unix en unix2dos kunnen UTF-8-gecodeerde bestanden
omzetten, want UTF-8 is ontworpen op compatibiliteit met ASCII.
Dos2unix en unix2dos met Unicode UTF-16-ondersteuning kunnen little en
big endian UTF-16-gecodeerde tekstbestanden lezen. Om er achter te komen
of dos2unix gebouwd is met UTF-16- ondersteuning, typt u "dos2unix -V".
Op Unix/Linux worden UTF-16-bestanden geconverteerd naar de codering van
de ingestelde taalregio. Gebruik de opdracht locale(1) om te zien wat de
ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er
een fout op en wordt het bestand overgeslagen.
Op Windows worden UTF-16-bestanden standaard naar UTF-8 geconverteerd.
UTF-8-tekstbestanden worden alom goed ondersteund, zowel op Windows als
Unix/Linux.
De UTF-16- en UTF-8-coderingen zijn volledig compatibel, er gaat bij het
converteren niets verloren. Als er tijdens de conversie van UTF-16 naar
UTF-8 een fout optreedt, bijvoorbeeld omdat het UTF-16-invoerbestand een
fout bevat, dan wordt het bestand overgeslagen.
Wanneer "-u" gebruikt wordt, wordt het uitvoerbestand in dezelfde
UTF-16-codering geschreven als het invoerbestand. Optie "-u" voorkomt
conversie naar UTF-8.
Dos2unix en unix2dos hebben geen optie om van UTF-8 naar UTF-16 te
converteren.
ISO- en 7-bits-conversie werken niet op UTF-16-bestanden.
Byte-Order-Mark
Op Windows bevatten Unicode-tekstbestanden gewoonlijk een
Byte-Order-Mark (BOM), omdat veel Windows-programma's (inclusief
Kladblok) standaard een BOM toevoegen. Zie ook
<http://en.wikipedia.org/wiki/Byte_order_mark>.
Op Unix hebben Unicode-tekstbestanden meestal geen BOM. Er wordt
aangenomen dat de codering van tekstbestanden gelijk is aan de
tekencodering van de ingestelde taalregio.
Dos2unix kan alleen detecteren of een bestand in UTF-16-codering is als
het bestand een BOM bevat. Wanneer een UTF-16-bestand geen BOM heeft,
ziet dos2unix het bestand als een binair bestand.
Gebruik optie "-ul" of "-ub" om een UTF-16-bestand zonder BOM om te
zetten.
Dos2unix schrijft standaard geen BOM in het uitvoerbestand. Met optie
"-b" schrijft dos2unix een BOM wanneer het invoerbestand een BOM bevat.
Unix2dos schrijft standaard een BOM in het uitvoerbestand wanneer het
invoerbestand een BOM bevat. Gebruik optie "-r" om de BOM te
verwijderen.
Dos2unix en unix2dos schrijven altijd een BOM wanneer optie "-m"
gebruikt wordt.
Unicode-voorbeelden
Omzetten van Windows UTF-16 (met BOM) naar Unix UTF-8:
dos2unix -n in.txt uit.txt
Omzetten van Windows UTF-16LE (zonder BOM) naar Unix UTF-8:
dos2unix -ul -n in.txt uit.txt
Omzetten van Unix UTF-8 naar Windows UTF-8 met BOM:
unix2dos -m -n in.txt uit.txt
Omzetten van Unix UTF-8 naar Windows UTF-16:
unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > uit.txt
GB18030
GB18030 is een standaard van de Chinese overheid. Een subset van de
GB18030-standaard is officieel verplicht voor alle softwareproducten die
in China verkocht worden. Zie ook
<http://en.wikipedia.org/wiki/GB_18030>.
GB18030 is volledig compatibel met Unicode, en kan als een
Unicodetransformatie beschouwd worden. Net als UTF-8 is GB18030
compatibel met ASCII. GB18030 is ook compatibel met Windows-codetabel
936 (ook wel GBK genoemd).
Op Unix/Linux worden UTF-16-bestanden alleen naar GB18030 geconverteerd
wanneer de taalregio op China ingesteld is en de codering op GB18030.
Bijvoorbeeld, met de Britse taalregio-instelling "en_GB.GB18030" zal
conversie van UTF-16 naar GB18030 niet werken, maar met de Chinese
instelling "zh_CN.GB18030" wel.
Op Windows dient u de optie "-gb" te gebruiken om UTF-16-bestanden naar
GB18030 te converteren.
GB18030-bestanden kunnen een Byte-Order-Mark bevatten, net als
Unicode-bestanden.
VOORBEELDEN
Invoer lezen van standaardinvoer en uitvoer schrijven naar
standaarduitvoer:
dos2unix
dos2unix -l -c mac
Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Omzetten en vervangen van a.txt in ascii-conversiemodus:
dos2unix a.txt
Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en
vervangen van b.txt in 7-bits conversiemodus:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Omzetten van a.txt van Mac- naar Unix-indeling:
dos2unix -c mac a.txt
mac2unix a.txt
Omzetten van a.txt van Unix- naar Mac-indeling:
unix2dos -c mac a.txt
unix2mac a.txt
Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:
dos2unix -k a.txt
dos2unix -k -o a.txt
Omzetten van a.txt en resultaat naar e.txt schrijven:
dos2unix -n a.txt e.txt
Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt
gelijk aan die van a.txt:
dos2unix -k -n a.txt e.txt
Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt
schrijven:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van
a.txt; omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt
schrijven.
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
RECURSIEVE CONVERSIE
Gebruik dos2unix in combinatie met de opdrachten find(1) en xargs(1) om
tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om
alle .txt-bestanden in de mappenboom onder de huidige map te
converteren, typt u:
find . -name *.txt |xargs dos2unix
LOKALISATIE
LANG
De primaire taal wordt geselecteerd via de omgevingsvariabele LANG.
De variabele LANG bestaat uit verschillende onderdelen. Het eerste
deel is in kleine letters de taalcode. Het tweede deel is optioneel
en is de landcode in hoofdletters, voorafgegaan door een liggend
streepje. Er is ook een optioneel derde deel: de tekencodering,
voorafgegaan door een punt. Enkele voorbeelden voor een POSIX-shell:
export LANG=nl Nederlands
export LANG=nl_NL Nederlands, Nederland
export LANG=nl_BE Nederlands, België
export LANG=es_ES Spaans, Spanje
export LANG=es_MX Spaans, Mexico
export LANG=en_US.iso88591 Engels, VS, Latin-1-codering
export LANG=en_GB.UTF-8 Engels, GB, UTF-8-codering
Voor een complete lijst van taal- en landcodes zie de
gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
Op Unix-systemen kunt u de opdracht locale(1) gebruiken om
specifieke taalregio-informatie te verkrijgen.
LANGUAGE
Met de omgevingsvariabele LANGUAGE kunt u een prioriteitenlijst
specificeren van talen, gescheiden door dubbele punten. Dos2unix
geeft voorrang aan LANGUAGE boven LANG. Bijvoorbeeld, eerst
Nederlands en dan Duits: "LANGUAGE=nl:de". U moet eerst lokalisatie
in werking stellen, door het instellen van LANG (of LC_ALL) op een
waarde ongelijk aan "C", voordat u een talen-prioriteitenlijst kunt
gebruiken via de variabele LANGUAGE. Zie ook de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Als u een taal kiest die niet beschikbaar is, worden de standaard
Engelse berichten gebruikt.
DOS2UNIX_LOCALEDIR
Met de omgevingsvariabele DOS2UNIX_LOCALEDIR kan de LOCALEDIR die
ingesteld werd tijdens compilatie worden overstemd. LOCALEDIR wordt
gebruikt om de taalbestanden te vinden. De GNU standaardwaarde is
"/usr/local/share/locale". De optie --version laat de gebruikte
LOCALEDIR zien.
Voorbeeld (POSIX-shell):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
AFSLUITWAARDE
Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt
wordt het laatste systeemfoutnummer teruggegeven. Bij andere fouten
wordt 1 teruggegeven.
De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve
wanneer verkeerde opties worden gegeven.
STANDAARDEN
<http://nl.wikipedia.org/wiki/Tekstbestand>
<http://nl.wikipedia.org/wiki/Carriage_Return>
<http://nl.wikipedia.org/wiki/Linefeed>
<http://nl.wikipedia.org/wiki/Unicode>
AUTEURS
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(mac2unix-modus) - <wuebben@kde.org>, Christian Wurll (toevoegen van
extra regeleindes) - <wurll@ira.uka.de>, Erwin Waterlander -
<waterlan@xs4all.nl> (beheerder)
Projectpagina: <http://waterlan.home.xs4all.nl/dos2unix.html>
SourceForge-pagina: <http://sourceforge.net/projects/dos2unix/>
ZIE OOK
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - konwerter formatu plików tekstowych między systemami DOS/Mac a Uniksem</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NAZWA">NAZWA</a></li>
<li><a href="#SKADNIA">SK&#x141;ADNIA</a></li>
<li><a href="#OPIS">OPIS</a></li>
<li><a href="#OPCJE">OPCJE</a></li>
<li><a href="#TRYB-MAC">TRYB MAC</a></li>
<li><a href="#TRYBY-KONWERSJI">TRYBY KONWERSJI</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Kodowania">Kodowania</a></li>
<li><a href="#Konwersje">Konwersje</a></li>
<li><a href="#Znacznik-BOM">Znacznik BOM</a></li>
<li><a href="#Przykady-Unicode">Przyk&#x142;ady Unicode</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#PRZYKADY">PRZYK&#x141;ADY</a></li>
<li><a href="#KONWERSJA-REKURENCYJNA">KONWERSJA REKURENCYJNA</a></li>
<li><a href="#LOKALIZACJA">LOKALIZACJA</a></li>
<li><a href="#WARTO-ZWRACANA">WARTO&#x15A;&#x106; ZWRACANA</a></li>
<li><a href="#STANDARDY">STANDARDY</a></li>
<li><a href="#AUTORZY">AUTORZY</a></li>
<li><a href="#ZOBACZ-TAKE">ZOBACZ TAK&#x17B;E</a></li>
</ul>
<h1 id="NAZWA">NAZWA</h1>
<p>dos2unix - konwerter formatu plik&oacute;w tekstowych mi&#x119;dzy systemami DOS/Mac a Uniksem</p>
<h1 id="SKADNIA">SK&#x141;ADNIA</h1>
<pre><code> dos2unix [opcje] [PLIK ...] [-n PLIK_WEJ PLIK_WYJ ...]
unix2dos [opcje] [PLIK ...] [-n PLIK_WEJ PLIK_WYJ ...]</code></pre>
<h1 id="OPIS">OPIS</h1>
<p>Pakiet Dos2unix zawiera narz&#x119;dzia <code>dos2unix</code> oraz <code>unix2dos</code> do konwersji zwyk&#x142;ych plik&oacute;w tekstowych mi&#x119;dzy formatami u&#x17C;ywanymi w systemach DOS lub Mac a formatem uniksowym.</p>
<p>W plikach tekstowych systemu DOS/Windows oznaczenie ko&#x144;ca linii to po&#x142;&#x105;czenie dw&oacute;ch znak&oacute;w: powrotu karetki (CR) i przesuni&#x119;cia linii (LF). W uniksowych plikach tekstowych koniec linii to pojedynczy znak LF. W plikach tekstowych systemu Mac sprzed Mac OS X koniec linii by&#x142; pojedynczym znakiem CR. Obecnie Mac OS wykorzystuje uniksowe ko&#x144;ce linii (LF).</p>
<p>Opr&oacute;cz oznacze&#x144; ko&#x144;c&oacute;w linii Dos2unix potrafi konwertowa&#x107; tak&#x17C;e kodowanie plik&oacute;w. Kilko stron kodowych DOS-a mo&#x17C;e by&#x107; przekonwertowanych do uniksowego Latin-1, a windowsowy Unicode (UTF-16) do powszechniejszego pod Uniksem kodowania Unicode UTF-8.</p>
<p>Pliki binarne s&#x105; pomijane automatycznie, chyba &#x17C;e konwersja zostanie wymuszona.</p>
<p>Pliki inne ni&#x17C; zwyk&#x142;e, np. katalogi lub FIFO, s&#x105; pomijane automatycznie.</p>
<p>Dowi&#x105;zania symboliczne i ich cele s&#x105; domy&#x15B;lnie pozostawiane bez zmian. Dowi&#x105;zania symboliczne mog&#x105; by&#x107; opcjonalnie zast&#x119;powane, albo wyj&#x15B;cie mo&#x17C;e by&#x107; zapisywane do celu dowi&#x105;zania. Zapis do celu dowi&#x105;zania symbolicznego nie jest obs&#x142;ugiwane pod Windows.</p>
<p>Dos2unix powsta&#x142; na podstawie narz&#x119;dzia dos2unix z systemu SunOS/Solaris. Jest jedna istotna r&oacute;&#x17C;nica w stosunku do oryginalnej wersji z SunOS-a/Solarisa: ta wersja domy&#x15B;lnie wykonuje konwersj&#x119; w miejscu (tryb starego pliku), podczas gdy oryginalna obs&#x142;ugiwa&#x142;a tylko konwersj&#x119; parami (tryb nowego pliku) - p. tak&#x17C;e opcje <code>-o</code> i <code>-n</code>.</p>
<h1 id="OPCJE">OPCJE</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Potraktowanie wszystkich kolejnych opcji jako nazw plik&oacute;w. Tej opcji nale&#x17C;y u&#x17C;y&#x107;, aby przekonwertowa&#x107; pliki, kt&oacute;rych nazwy zaczynaj&#x105; si&#x119; od minusa. Przyk&#x142;adowo, aby przekonwertowa&#x107; plik o nazwie &quot;-foo&quot;, mo&#x17C;na u&#x17C;y&#x107; polecenia:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>Lub w trybie nowego pliku:</p>
<pre><code> dos2unix -n -- -foo out.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>Konwersja tylko znak&oacute;w ko&#x144;ca linii. Jest to domy&#x15B;lny tryb konwersji.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Konwersja mi&#x119;dzy zestawami znak&oacute;w DOS i ISO-8859-1. Wi&#x119;cej w sekcji TRYBY KONWERSJI.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej Windows 1252 (zachodnioeuropejskiej).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej DOS 437 (US). Jest to domy&#x15B;lna strona kodowa u&#x17C;ywana przy konwersji ISO.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej DOS 850 (zachodnioeuropejskiej).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej DOS 860 (portugalskiej).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej DOS 863 (kanadyjskiej francuskiej).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>U&#x17C;ycie strony kodowej DOS 865 (nordyckiej).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Konwersja znak&oacute;w 8-bitowych do przestrzeni 7-bitowej.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>Zachowanie znaku BOM (Byte Order Makr). Je&#x17C;eli plik wej&#x15B;ciowy zawiera BOM, powoduje zapisanie go w pliku wyj&#x15B;ciowym. Jest to domy&#x15B;lne zachowanie przy konwersji na DOS-owe ko&#x144;ce linii. P. tak&#x17C;e opcja <code>-r</code>.</p>
</dd>
<dt id="c---convmode-TRYB_KONW"><b>-c, --convmode TRYB_KONW</b></dt>
<dd>
<p>Ustawienie trybu konwersji. TRYB_KONW to jeden z: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i>, przy czym domy&#x15B;lny jest ascii.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>Wymuszenie konwersji plik&oacute;w binarnych.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>Pod Windows pliki w UTF-16 s&#x105; domy&#x15B;lnie konwertowane do UTF-8, niezale&#x17C;nie od ustawienia lokalizacji. Ta opcja pozwala przekonwertowa&#x107; pliki w UTF-16 do GB18030. Opcja jest dost&#x119;pna tylko pod Windows, wi&#x119;cej w sekcji dotycz&#x105;cej GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>Wy&#x15B;wietlenie opisu i zako&#x144;czenie.</p>
</dd>
<dt id="i-FLAGI---info-FLAGI-PLIK"><b>-i[FLAGI], --info[=FLAGI] PLIK ...</b></dt>
<dd>
<p>Wy&#x15B;wietlenie informacji o pliku. Konwersja nie jest wykonywana.</p>
<p>Wypisywane s&#x105; nast&#x119;puj&#x105;ce informacje, w tej kolejno&#x15B;ci: liczba DOS-owych ko&#x144;c&oacute;w linii, liczba uniksowych ko&#x144;c&oacute;w linii, liczba macowych ko&#x144;c&oacute;w linii, znacznik BOM, tekstowy lub binarny, nazwa pliku.</p>
<p>Przyk&#x142;adowe wyj&#x15B;cie:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Opcjonalnie mo&#x17C;na ustawi&#x107; dodatkowe flagi, aby zmieni&#x107; wyj&#x15B;cie. Mo&#x17C;na doda&#x107; jedn&#x105; lub wi&#x119;cej flag.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Wypisanie liczby DOS-owych ko&#x144;c&oacute;w linii.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Wypisanie liczby uniksowych ko&#x144;c&oacute;w linii.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Wypisanie liczby macowych ko&#x144;c&oacute;w linii.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>Wypisanie znacznika BOM.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Wypisanie, czy plik jest tekstowy, czy binarny.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Wypisanie tylko plik&oacute;w, kt&oacute;re zosta&#x142;yby przekonwertowane.</p>
<p>Z flag&#x105; <code>c</code> dos2unix wypisze tylko pliki zawieraj&#x105;ce DOS-owe ko&#x144;ce linii, a unix2dos wypisze tylko nazwy plik&oacute;w zawieraj&#x105;cych uniksowe ko&#x144;ce linii.</p>
</dd>
</dl>
<p>Przyk&#x142;ady:</p>
<p>Pokazanie informacji o wszystkich plikach *.txt:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Pokazanie tylko liczby DOS-owych i uniksowych ko&#x144;c&oacute;w linii:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Pokazanie tylko znacznika BOM:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>Wypisanie listy plik&oacute;w zawieraj&#x105;cych DOS-owe ko&#x144;ce linii:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>Wypisanie listy plik&oacute;w zawieraj&#x105;cych uniksowe ko&#x144;ce linii:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>Zachowanie znacznika czasu pliku wyj&#x15B;ciowego takiego samego, jak pliku wej&#x15B;ciowego.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>Wy&#x15B;wietlenie licencji programu.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>Dodanie dodatkowego znaku ko&#x144;ca linii.</p>
<p><b>dos2unix</b>: tylko DOS-owe znaki ko&#x144;ca linii s&#x105; zamieniane na dwa uniksowe. W trybie Mac tylko macowe znaki ko&#x144;ca linii s&#x105; zamieniane na dwa uniksowe.</p>
<p><b>unix2dos</b>: tylko uniksowe znaki ko&#x144;ca linii s&#x105; zamieniane na dwa DOS-owe. W trybie Mac uniksowe znaki ko&#x144;ca linii s&#x105; zamieniane na dwa macowe.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>Zapisanie znacznika BOM (Byte Order Mark) w pliku wyj&#x15B;ciowym. Domy&#x15B;lnie zapisywany jest BOM UTF-8.</p>
<p>Je&#x15B;li plik wej&#x15B;ciowy jest w kodowaniu UTF-16 i u&#x17C;yto opcji <code>-u</code>, zostanie zapisany BOM UTF-16.</p>
<p>Nigdy nie nale&#x17C;y u&#x17C;ywa&#x107; tej opcji, je&#x15B;li kodowanie wyj&#x15B;ciowe jest inne ni&#x17C; UTF-8 lub UTF-16. Wi&#x119;cej w sekcji UNICODE.</p>
</dd>
<dt id="n---newfile-PLIK_WEJ-PLIK_WYJ"><b>-n, --newfile PLIK_WEJ PLIK_WYJ ...</b></dt>
<dd>
<p>Tryb nowego pliku. Konwersja PLIKU_WEJ z zapisem wyj&#x15B;cia do PLIKU_WYJ. Nazwy plik&oacute;w musz&#x105; by&#x107; podane parami, a masek <i>nie</i> nale&#x17C;y u&#x17C;ywa&#x107;, gdy&#x17C; <i>spowoduje</i> to utrat&#x119; plik&oacute;w.</p>
<p>Osoba uruchamiaj&#x105;ca konwersj&#x119; w trybie nowego pliku (par) b&#x119;dzie w&#x142;a&#x15B;cicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego pliku b&#x119;d&#x105; pochodzi&#x142;y z praw pliku oryginalnego po odj&#x119;ciu umask(1) osoby uruchamiaj&#x105;cej konwersj&#x119;.</p>
</dd>
<dt id="o---oldfile-PLIK"><b>-o, --oldfile PLIK ...</b></dt>
<dd>
<p>Tryb starego pliku. Konwersja PLIKU i nadpisanie go wyj&#x15B;ciem. Program dzia&#x142;a domy&#x15B;lnie w tym trybie. Mo&#x17C;na u&#x17C;ywa&#x107; masek.</p>
<p>W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje tego samego w&#x142;a&#x15B;ciciela, grup&#x119; oraz prawa odczytu/zapisu, jak plik oryginalny - tak&#x17C;e wtedy, gdy plik jest konwertowany przez innego u&#x17C;ytkownika, maj&#x105;cego prawo zapisu do pliku (np. przez u&#x17C;ytkownika root). Konwersja zostanie przerwana, je&#x15B;li nie b&#x119;dzie mo&#x17C;liwe zachowanie oryginalnych warto&#x15B;ci. Zmiana w&#x142;a&#x15B;ciciela mog&#x142;aby oznacza&#x107;, &#x17C;e pierwotny w&#x142;a&#x15B;ciciel nie mo&#x17C;e ju&#x17C; odczyta&#x107; pliku. Zmiana grupy mog&#x142;aby by&#x107; zagro&#x17C;eniem bezpiecze&#x144;stwa, plik m&oacute;g&#x142;by by&#x107; czytelny dla nie zamierzonych os&oacute;b. Zachowanie w&#x142;a&#x15B;ciciela, grupy i praw odczytu/zapisu jest obs&#x142;ugiwane tylko na Uniksie.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Tryb cichy. Pomini&#x119;cie wszystkich ostrze&#x17C;e&#x144; i komunikat&oacute;w. Zwracanym kodem jest zero, chyba &#x17C;e podano b&#x142;&#x119;dne opcje linii polece&#x144;.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>Usuni&#x119;cie znak&oacute;w BOM (Byte Order Mark). Bez zapisywania BOM do pliku wyj&#x15B;ciowego. Jest to domy&#x15B;lne zachowanie przy konwersji na uniksowe ko&#x144;ce linii. P. tak&#x17C;e opcja <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>Pomini&#x119;cie plik&oacute;w binarnych (domy&#x15B;lne).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>Zachowanie oryginalnego kodowania pliku wej&#x15B;ciowego UTF-16. Plik wyj&#x15B;ciowy zostanie zapisany w tym samym kodowaniu UTF-16 (little lub big endian), co plik wej&#x15B;ciowy. Zapobiega to przekszta&#x142;ceniu do UTF-8. Do pliku zostanie zapisany odpowiedni znacznik BOM UTF-16. T&#x119; opcj&#x119; mo&#x17C;na wy&#x142;&#x105;czy&#x107; opcj&#x105; <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>Przyj&#x119;cie, &#x17C;e format pliku wej&#x15B;ciowego to UTF-16LE.</p>
<p>Je&#x15B;li w pliku wej&#x15B;ciowym jest znacznik BOM (Byte Order Mark), ma on priorytet nad t&#x105; opcj&#x105;.</p>
<p>Je&#x15B;li przyj&#x119;to b&#x142;&#x119;dne za&#x142;o&#x17C;enie (plik wej&#x15B;ciowy nie jest w formacie UTF-16LE), a konwersja si&#x119; uda, wynikiem b&#x119;dzie plik wyj&#x15B;ciowy UTF-8 ze z&#x142;ym tekstem. Konwersj&#x119; t&#x119; mo&#x17C;na odwr&oacute;ci&#x107; przy u&#x17C;yciu polecenia iconv(1) do konwersji wyj&#x15B;cia UTF-8 z powrotem do UTF-16LE. Przywr&oacute;ci to plik oryginalny.</p>
<p>Przyj&#x119;cie UTF-16LE dzia&#x142;a jako <i>tryb konwersji</i>. Przy prze&#x142;&#x105;czeniu na domy&#x15B;lny tryb <i>ascii</i> przyj&#x119;cie UTF-16LE jest wy&#x142;&#x105;czane.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>Przyj&#x119;cie, &#x17C;e format pliku wej&#x15B;ciowego to UTF-16BE.</p>
<p>Ta opcja dzia&#x142;a analogicznie do <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>Wy&#x15B;wietlanie szczeg&oacute;&#x142;owych komunikat&oacute;w. Wy&#x15B;wietlane &#x15B;a dodatkowe informacje o znacznikach BOM (Byte Order Mark) oraz liczbie przekonwertowanych ko&#x144;c&oacute;w linii.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>Pod&#x105;&#x17C;anie za dowi&#x105;zaniami symbolicznymi i konwertowanie ich cel&oacute;w</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>Zast&#x119;powanie dowi&#x105;za&#x144; symbolicznych przekonwertowanymi plikami (oryginalne pliki docelowe pozostaj&#x105; bez zmian).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>Pozostawienie dowi&#x105;za&#x144; symbolicznych i cel&oacute;w bez zmian (domy&#x15B;lne).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>Wy&#x15B;wietlenie informacji o wersji i zako&#x144;czenie.</p>
</dd>
</dl>
<h1 id="TRYB-MAC">TRYB MAC</h1>
<p>W zwyk&#x142;ym trybie znaki ko&#x144;ca linii s&#x105; konwertowane z DOS-a do Uniksa i odwrotnie. Znaki ko&#x144;ca linii systemu Mac nie s&#x105; konwertowane.</p>
<p>W trybie Mac znaki ko&#x144;ca linii s&#x105; konwertowane z formatu Maca do Uniksa i odwrotnie. Znaki ko&#x144;ca linii systemu DOS nie s&#x105; zmieniane.</p>
<p>Aby uruchomi&#x107; program w trybie Mac, nale&#x17C;y u&#x17C;y&#x107; opcji linii polece&#x144; <code>-c mac</code> albo u&#x17C;y&#x107; polece&#x144; <code>mac2unix</code> lub <code>unix2mac</code>.</p>
<h1 id="TRYBY-KONWERSJI">TRYBY KONWERSJI</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>W trybie <code>ascii</code> konwertowane s&#x105; tylko ko&#x144;ce linii. Jest to domy&#x15B;lny tryb konwersji.</p>
<p>Mimo &#x17C;e nazwa tego trybu to ASCII, kt&oacute;re jest standardem 7-bitowym, jest to tryb 8-bitowy. Nale&#x17C;y zawsze u&#x17C;ywa&#x107; tego trybu przy konwersji plik&oacute;w Unicode UTF-8.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>W tym trybie wszystkie znaki 8-bitowe spoza ASCII (o warto&#x15B;ciach od 128 do 255) s&#x105; konwertowane do przestrzeni 7-bitowej.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>W tym trybie znaki s&#x105; konwertowane mi&#x119;dzy zestawem znak&oacute;w DOS (stron&#x105; kodow&#x105;) a zestawem znak&oacute;w ISO-8859-1 (Latin-1) u&#x17C;ywanym na Uniksie. Znaki DOS-owe nie maj&#x105;ce odpowiednika w ISO-8859-1, kt&oacute;rych nie da si&#x119; przekonwertowa&#x107;, s&#x105; zamieniane na kropk&#x119;. To samo dotyczy znak&oacute;w ISO-8859-1 bez odpowiednika w DOS-ie.</p>
<p>Je&#x15B;li u&#x17C;ywana jest tylko opcja <code>-iso</code>, dos2unix pr&oacute;buje wykry&#x107; aktywn&#x105; stron&#x119; kodow&#x105;. Je&#x15B;li nie jest to mo&#x17C;liwe, dos2unix u&#x17C;ywa domy&#x15B;lnej strony kodowej CP437, stosowanej g&#x142;&oacute;wnie w USA. Aby wymusi&#x107; okre&#x15B;lon&#x105; stron&#x119; kodow&#x105;, nale&#x17C;y u&#x17C;y&#x107; opcji <code>-437</code> (US), <code>-850</code> (zachodnioeuropejska), <code>-860</code> (portugalska), <code>-863</code> (kanadyjska francuska) lub <code>-865</code> (nordycka). Ponadto obs&#x142;ugiwana jest strona kodowa Windows CP1252 (zachodnioeuropejska) przy u&#x17C;yciu opcji <code>-1252</code>. W przypadku innych stron kodowych mo&#x17C;na u&#x17C;y&#x107; narz&#x119;dzia dos2unix wraz z iconv(1). Iconv potrafi konwertowa&#x107; mi&#x119;dzy wieloma kodowaniami znak&oacute;w.</p>
<p>Nigdy nie nale&#x17C;y u&#x17C;ywa&#x107; konwersji ISO na plikach tekstowych w Unicode. Uszkodzi&#x142;aby pliki kodowane UTF-8.</p>
<p>Kilka przyk&#x142;ad&oacute;w:</p>
<p>Konwersja z domy&#x15B;lnej strony kodowej DOS do uniksowego Latin-1:</p>
<pre><code> dos2unix -iso -n in.txt out.txt</code></pre>
<p>Konwersja ze strony kodowej DOS CP850 do uniksowego Latin-1:</p>
<pre><code> dos2unix -850 -n in.txt out.txt</code></pre>
<p>Konwersja ze strony kodowej Windows CP1252 do uniksowego Latin-1:</p>
<pre><code> dos2unix -1252 -n in.txt out.txt</code></pre>
<p>Konwersja ze strony kodowej Windows CP1252 do uniksowego UTF-8 (Unicode):</p>
<pre><code> iconv -f CP1252 -t UTF-8 in.txt | dos2unix &gt; out.txt</code></pre>
<p>Konwersa z uniksowego Latin-1 do domy&#x15B;lnej strony kodowej DOS:</p>
<pre><code> unix2dos -iso -n in.txt out.txt</code></pre>
<p>Konwersja z uniksowego Latin-1 do strony kodowej DOS CP850:</p>
<pre><code> unix2dos -850 -n in.txt out.txt</code></pre>
<p>Konwersja z uniksowego Latin-1 do strony kodowej Windows CP1252:</p>
<pre><code> unix2dos -1252 -n in.txt out.txt</code></pre>
<p>Konwersja z uniksowego UTF-8 (Unicode) do strony kodowej Windows CP1252:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t CP1252 &gt; out.txt</code></pre>
<p>Wi&#x119;cej pod adresem <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> oraz <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Kodowania">Kodowania</h2>
<p>Istniej&#x105; r&oacute;&#x17C;ne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode s&#x105; zwykle kodowane z u&#x17C;yciem UTF-8. Pod Windows pliki tekstowe Unicode mog&#x105; by&#x107; kodowane w UTF-8, UTF-16, UTF-16 big-endian, ale przewa&#x17C;nie s&#x105; kodowane w UTF-16.</p>
<h2 id="Konwersje">Konwersje</h2>
<p>Pliki tekstowe Unicode mog&#x105; mie&#x107; znaki ko&#x144;ca linii systemu DOS, Unix lub Mac, podobnie jak zwyk&#x142;e pliki tekstowe.</p>
<p>Wszystkie wersje dos2unix i unix2dos potrafi&#x105; konwertowa&#x107; pliki kodowane UTF-8, poniewa&#x17C; UTF-8 jest wstecznie zgodne z ASCII.</p>
<p>Dos2unix i unix2dos z obs&#x142;ug&#x105; Unicode UTF-16 potrafi&#x105; odczytywa&#x107; pliki tekstowe kodowane UTF-16 little- oraz big-endian. Aby sprawdzi&#x107;, czy dos2unix zosta&#x142; zbudowany z obs&#x142;ug&#x105; UTF-16, nale&#x17C;y napisa&#x107; <code>dos2unix -V</code>.</p>
<p>Pod Uniksem/Linuksem pliki w kodowaniu UTF-16 s&#x105; konwertowane do kodowania znak&oacute;w ustawionej lokalizacji. Kodowanie znak&oacute;w dla lokalizacji mo&#x17C;na sprawdzi&#x107; poleceniem locale(1). Je&#x15B;li konwersja nie jest mo&#x17C;liwa, wyst&#x105;pi b&#x142;&#x105;d, a plik zostanie pomini&#x119;ty.</p>
<p>Pod Windows pliki UTF-16 s&#x105; domy&#x15B;lnie konwertowane do UTF-8. Pliki tekstkowe w kodowaniu UTF-8 s&#x105; dobrze obs&#x142;ugiwane zar&oacute;wno pod Windows, jak i Uniksem/Linuksem.</p>
<p>Kodowania UTF-16 i UTF-8 s&#x105; w pe&#x142;ni zgodne, konwersja nie spowoduje utraty &#x17C;adnej cz&#x119;&#x15B;ci tekstu. W przypadku wyst&#x105;pienia b&#x142;&#x119;du konwersji, na przyk&#x142;ad w przypadku b&#x142;&#x119;du w pliku wej&#x15B;ciowym UTF-16, plik zostanie pomini&#x119;ty.</p>
<p>W przypadku u&#x17C;ycia opcji <code>-u</code>, plik wej&#x15B;ciowy zostanie zapisany w tym samym kodowaniu UTF-16, co plik wej&#x15B;ciowy. Opcja <code>-u</code> zapobiega konwersji do UTF-8.</p>
<p>Dos2unix oraz unix2dos nie maj&#x105; opcji pozwalaj&#x105;cej na konwersj&#x119; plik&oacute;w UTF-8 do UTF-16.</p>
<p>Tryby konwersji ISO i 7-bit nie dzia&#x142;aj&#x105; na plikach UTF-16.</p>
<h2 id="Znacznik-BOM">Znacznik BOM</h2>
<p>W systemie Windows pliki tekstowe zwykle zawieraj&#x105; znacznik BOM (Byte Order Mark), poniewa&#x17C; wiele program&oacute;w dla Windows (w tym Notepad) dodaje domy&#x15B;lnie znaczniki BOM. Wi&#x119;cej informacji mo&#x17C;na znale&#x17A;&#x107; pod adresem <a href="http://pl.wikipedia.org/wiki/BOM_(informatyka)">http://pl.wikipedia.org/wiki/BOM_(informatyka)</a>.</p>
<p>Pod Uniksem pliki Unicode zwykle nie maj&#x105; znacznika BOM. Pliki tekstowe s&#x105; traktowane jako kodowane zgodnie z kodowaniem znak&oacute;w ustawionej lokalizacji.</p>
<p>Dos2unix potrafi wykry&#x107; tylko, czy plik jest w formacie UTF-16, je&#x15B;li zawiera znacznik BOM. Je&#x15B;li plik UTF-16 nie ma tego znacznika, dos2unix potraktuje plik jako binarny.</p>
<p>Do konwersji pliku UTF-16 bez znacznika BOM mo&#x17C;na u&#x17C;y&#x107; opcji <code>-ul</code> lub <code>-ub</code>.</p>
<p>Dos2unix nie zapisuje domy&#x15B;lnie znaku BOM w pliku wyj&#x15B;ciowym. Z opcj&#x105; <code>-b</code> Dos2unix zapisuje BOM, je&#x15B;li plik wej&#x15B;ciowy zawiera BOM.</p>
<p>Unix2dos domy&#x15B;lnie zapisuje znaczniki BOM w pliku wyj&#x15B;ciowym, je&#x15B;li plik wej&#x15B;ciowy ma BOM. Aby usun&#x105;&#x107; BOM, mo&#x17C;na u&#x17C;y&#x107; opcji <code>-r</code>.</p>
<p>Dos2unix oraz unix2dos zawsze zapisuj&#x105; znaczniki BOM, je&#x15B;li u&#x17C;yta zostanie opcja <code>-m</code>.</p>
<h2 id="Przykady-Unicode">Przyk&#x142;ady Unicode</h2>
<p>Konwersja pliku UTF-16 (z BOM) z formatu Windows do uniksowego UTF-8:</p>
<pre><code> dos2unix -n in.txt out.txt</code></pre>
<p>Konwersja pliku UTF-16LE (bez BOM) z formatu Windows do uniksowego UTF-8:</p>
<pre><code> dos2unix -ul -n in.txt out.txt</code></pre>
<p>Konwersja z uniksowego UTF-8 do UTF-8 z BOM dla Windows:</p>
<pre><code> unix2dos -m -n in.txt out.txt</code></pre>
<p>Konwersja z uniksowego UTF-8 do UTF-16 dla Windows:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t UTF-16 &gt; out.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 to standard urz&#x119;dowy w Chinach. Obowi&#x105;zkowy podzbi&oacute;r standardu GB18030 jest oficjalnym wymaganiem ka&#x17C;dego oprogramowania sprzedawanego w Chinach. Wi&#x119;cej pod adresem <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 jest w pe&#x142;ni zgodny z Unicode i mo&#x17C;e by&#x107; uwa&#x17C;any za format transformacji unikodu. Podobnie jak UTF-8, GB18030 jest zgodny z ASCII. Jest tak&#x17C;e zgodny ze stron&#x105; kodow&#x105; Windows 936, znan&#x105; te&#x17C; jako GBK.</p>
<p>Pod Uniksem/Linuksem pliki UTF-16 s&#x105; konwertowane do GB18030, je&#x15B;li kodowanie dla lokalizacji jest ustawione na GB18030. Uwaga: b&#x119;dzie to dzia&#x142;a&#x107; tylko dla lokalizacji chi&#x144;skiej. W przypadku np. ustawienia lokalizacji angielskiej/brytyjskiej <code>en_GB.GB18030</code> konwersja UTF-16 do GB18030 nie b&#x119;dzie dzia&#x142;a&#x107;, a dla lokalizacji chi&#x144;skiej <code>zh_CN.GB18030</code> b&#x119;dzie.</p>
<p>Pod Windows w celu konwersji plik&oacute;w UTF-16 do GB18030 nale&#x17C;y u&#x17C;y&#x107; opcji <code>-gb</code>.</p>
<p>Pliki w kodowaniu GB18030 mog&#x105; mie&#x107; znacznik BOM, podobnie jak pliki w Unicode.</p>
<h1 id="PRZYKADY">PRZYK&#x141;ADY</h1>
<p>Odczyt ze standardowego wej&#x15B;cia i zapis na standardowe wyj&#x15B;cie:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Konwersja i zast&#x105;pienie a.txt; konwersja i zast&#x105;pienie b.txt:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Konwersja i zast&#x105;pienie a.txt w trybie ascii:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Konwersja i zast&#x105;pienie a.txt w trybie ascii; konwersja i zast&#x105;pienie b.txt w trybie 7-bitowym:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Konwersja a.txt z formatu Mac do formatu uniksowego:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Konwersja a.txt z formatu uniksowego do formatu Mac:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Konwersja i zast&#x105;pienie a.txt z zachowaniem oryginalnego znacznika czasu:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Konwersja a.txt i zapis do e.txt:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt takiego, jak a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Konwersja i zast&#x105;pienie a.txt; konwersja b.txt i zapis do e.txt:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Konwersja c.txt i zapis do e.txt; konwersja i zast&#x105;pienie a.txt; konwersja i zast&#x105;pienie b.txt; konwersja d.txt i zapis do f.txt:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="KONWERSJA-REKURENCYJNA">KONWERSJA REKURENCYJNA</h1>
<p>Mo&#x17C;na u&#x17C;y&#x107; dos2unix w po&#x142;&#x105;czeniu z poleceniami find(1) i xargs(1) do rekurencyjnej konwersji plik&oacute;w tekstowych w strukturze drzewa katalog&oacute;w. Na przyk&#x142;ad, aby przekonwertowa&#x107; wszystkie pliki .txt w drzewie katalog&oacute;w poni&#x17C;ej katalogu bie&#x17C;&#x105;cego, nale&#x17C;y napisa&#x107;:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="LOKALIZACJA">LOKALIZACJA</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>G&#x142;&oacute;wny j&#x119;zyk wybiera si&#x119; zmienn&#x105; &#x15B;rodowiskow&#x105; LANG. Zmienna LANG sk&#x142;ada si&#x119; z kilku cz&#x119;&#x15B;ci. Pierwsza cz&#x119;&#x15B;&#x107; to ma&#x142;e litery oznaczaj&#x105;ce kod j&#x119;zyka. Druga cz&#x119;&#x15B;&#x107; jest opcjonalna i zawiera kod kraju pisany wielkimi literami, poprzedzony podkre&#x15B;leniem. Jest tak&#x17C;e opcjonalna trzecia cz&#x119;&#x15B;&#x107;: kodowanie znak&oacute;w, poprzedzone kropk&#x105;. Kilka przyk&#x142;ad&oacute;w dla pow&#x142;ok zgodnych ze standardem POSIX:</p>
<pre><code> export LANG=nl holenderski
export LANG=nl_NL holenderski, Holandia
export LANG=nl_BE holenderski, Belgia
export LANG=es_ES hiszpa&#x144;ski, Hiszpania
export LANG=es_MX hiszpa&#x144;ski, Meksyk
export LANG=en_US.iso88591 angielski, USA, kodowanie Latin-1
export LANG=en_GB.UTF-8 angielski, Wlk. Brytania, kodowanie UTF-8</code></pre>
<p>Pe&#x142;n&#x105; list&#x119; kod&oacute;w j&#x119;zyk&oacute;w i kraj&oacute;w mo&#x17C;na znale&#x17A;&#x107; w podr&#x119;czniku do gettexta: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>W systemach uniksowych do uzyskania informacji dotycz&#x105;cych lokalizacji mo&#x17C;na u&#x17C;y&#x107; polecenia locale(1).</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>Przy u&#x17C;yciu zmiennej &#x15B;rodowiskowej LANGUAGE mo&#x17C;na okre&#x15B;li&#x107; list&#x119; j&#x119;zyk&oacute;w wg priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje pierwsze&#x144;stwo zmiennej LANGUAGE nad LANG. Na przyk&#x142;ad, najpierw holenderski, nast&#x119;pnie niemiecki: <code>LANGUAGE=nl:de</code>. Aby skorzysta&#x107; z listy wg priorytet&oacute;w ze zmiennej LANGUAGE, trzeba najpierw w&#x142;&#x105;czy&#x107; lokalizacj&#x119; przez ustawienie zmiennej LANG (lub LC_ALL) na warto&#x15B;&#x107; inn&#x105; ni&#x17C; &quot;C&quot;. Wi&#x119;cej informacji znajduje si&#x119; w podr&#x119;czniku do gettexta: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>W przypadku wybrania niedost&#x119;pnego j&#x119;zyka, otrzymamy standardowe, angielskie komunikaty.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Przy u&#x17C;yciu zmiennej &#x15B;rodowiskowej DOS2UNIX_LOCALEDIR, mo&#x17C;na nadpisa&#x107; ustawienie LOCALEDIR z czasu kompilacji. LOCALEDIR to katalog u&#x17C;ywany do znalezienia plik&oacute;w lokalizacji. Domy&#x15B;ln&#x105; warto&#x15B;ci&#x105; dla GNU jest <code>/usr/local/share/locale</code>. Opcja <b>--version</b> wy&#x15B;wietla u&#x17C;ywan&#x105; warto&#x15B;&#x107; LOCALEDIR.</p>
<p>Przyk&#x142;ad (dla pow&#x142;oki POSIX):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="WARTO-ZWRACANA">WARTO&#x15A;&#x106; ZWRACANA</h1>
<p>W przypadku powodzenia zwracane jest zero. Je&#x15B;li wyst&#x105;pi b&#x142;&#x105;d systemowy, zwracany jest ostatni b&#x142;&#x105;d systemowy. W przypadku innych b&#x142;&#x119;d&oacute;w zwracane jest 1.</p>
<p>Warto&#x15B;&#x107; zwracana w trybie cichym to zawsze zero, z wyj&#x105;tkiem sytuacji podania b&#x142;&#x119;dnych opcji linii polece&#x144;.</p>
<h1 id="STANDARDY">STANDARDY</h1>
<p><a href="http://pl.wikipedia.org/wiki/Plik_tekstowy">http://pl.wikipedia.org/wiki/Plik_tekstowy</a></p>
<p><a href="http://en.wikipedia.org/wiki/Carriage_return">http://en.wikipedia.org/wiki/Carriage_return</a></p>
<p><a href="http://pl.wikipedia.org/wiki/End-of-line">http://pl.wikipedia.org/wiki/End-of-line</a></p>
<p><a href="http://pl.wikipedia.org/wiki/Unicode">http://pl.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTORZY">AUTORZY</h1>
<p>Benjamin Lin &lt;blin@socs.uts.edu.au&gt;; Bernd Johannes Wuebben (tryb mac2unix) &lt;wuebben@kde.org&gt;; Christian Wurll (dodawanie dodatkowej nowej linii) &lt;wurll@ira.uka.de&gt;; Erwin Waterlander &lt;waterlan@xs4all.nl&gt; (prowadz&#x105;cy)</p>
<p>Strona projektu: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>Strona SourceForge: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="ZOBACZ-TAKE">ZOBACZ TAK&#x17B;E</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,609 +0,0 @@
NAZWA
dos2unix - konwerter formatu plików tekstowych między systemami DOS/Mac
a Uniksem
SKŁADNIA
dos2unix [opcje] [PLIK ...] [-n PLIK_WEJ PLIK_WYJ ...]
unix2dos [opcje] [PLIK ...] [-n PLIK_WEJ PLIK_WYJ ...]
OPIS
Pakiet Dos2unix zawiera narzędzia "dos2unix" oraz "unix2dos" do
konwersji zwykłych plików tekstowych między formatami używanymi w
systemach DOS lub Mac a formatem uniksowym.
W plikach tekstowych systemu DOS/Windows oznaczenie końca linii to
połączenie dwóch znaków: powrotu karetki (CR) i przesunięcia linii (LF).
W uniksowych plikach tekstowych koniec linii to pojedynczy znak LF. W
plikach tekstowych systemu Mac sprzed Mac OS X koniec linii był
pojedynczym znakiem CR. Obecnie Mac OS wykorzystuje uniksowe końce linii
(LF).
Oprócz oznaczeń końców linii Dos2unix potrafi konwertować także
kodowanie plików. Kilko stron kodowych DOS-a może być przekonwertowanych
do uniksowego Latin-1, a windowsowy Unicode (UTF-16) do
powszechniejszego pod Uniksem kodowania Unicode UTF-8.
Pliki binarne są pomijane automatycznie, chyba że konwersja zostanie
wymuszona.
Pliki inne niż zwykłe, np. katalogi lub FIFO, są pomijane automatycznie.
Dowiązania symboliczne i ich cele są domyślnie pozostawiane bez zmian.
Dowiązania symboliczne mogą być opcjonalnie zastępowane, albo wyjście
może być zapisywane do celu dowiązania. Zapis do celu dowiązania
symbolicznego nie jest obsługiwane pod Windows.
Dos2unix powstał na podstawie narzędzia dos2unix z systemu
SunOS/Solaris. Jest jedna istotna różnica w stosunku do oryginalnej
wersji z SunOS-a/Solarisa: ta wersja domyślnie wykonuje konwersję w
miejscu (tryb starego pliku), podczas gdy oryginalna obsługiwała tylko
konwersję parami (tryb nowego pliku) - p. także opcje "-o" i "-n".
OPCJE
-- Potraktowanie wszystkich kolejnych opcji jako nazw plików. Tej opcji
należy użyć, aby przekonwertować pliki, których nazwy zaczynają się
od minusa. Przykładowo, aby przekonwertować plik o nazwie "-foo",
można użyć polecenia:
dos2unix -- -foo
Lub w trybie nowego pliku:
dos2unix -n -- -foo out.txt
-ascii
Konwersja tylko znaków końca linii. Jest to domyślny tryb konwersji.
-iso
Konwersja między zestawami znaków DOS i ISO-8859-1. Więcej w sekcji
TRYBY KONWERSJI.
-1252
Użycie strony kodowej Windows 1252 (zachodnioeuropejskiej).
-437
Użycie strony kodowej DOS 437 (US). Jest to domyślna strona kodowa
używana przy konwersji ISO.
-850
Użycie strony kodowej DOS 850 (zachodnioeuropejskiej).
-860
Użycie strony kodowej DOS 860 (portugalskiej).
-863
Użycie strony kodowej DOS 863 (kanadyjskiej francuskiej).
-865
Użycie strony kodowej DOS 865 (nordyckiej).
-7 Konwersja znaków 8-bitowych do przestrzeni 7-bitowej.
-b, --keep-bom
Zachowanie znaku BOM (Byte Order Makr). Jeżeli plik wejściowy
zawiera BOM, powoduje zapisanie go w pliku wyjściowym. Jest to
domyślne zachowanie przy konwersji na DOS-owe końce linii. P. także
opcja "-r".
-c, --convmode TRYB_KONW
Ustawienie trybu konwersji. TRYB_KONW to jeden z: *ascii*, *7bit*,
*iso*, *mac*, przy czym domyślny jest ascii.
-f, --force
Wymuszenie konwersji plików binarnych.
-gb, --gb18030
Pod Windows pliki w UTF-16 są domyślnie konwertowane do UTF-8,
niezależnie od ustawienia lokalizacji. Ta opcja pozwala
przekonwertować pliki w UTF-16 do GB18030. Opcja jest dostępna tylko
pod Windows, więcej w sekcji dotyczącej GB18030.
-h, --help
Wyświetlenie opisu i zakończenie.
-i[FLAGI], --info[=FLAGI] PLIK ...
Wyświetlenie informacji o pliku. Konwersja nie jest wykonywana.
Wypisywane są następujące informacje, w tej kolejności: liczba
DOS-owych końców linii, liczba uniksowych końców linii, liczba
macowych końców linii, znacznik BOM, tekstowy lub binarny, nazwa
pliku.
Przykładowe wyjście:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Opcjonalnie można ustawić dodatkowe flagi, aby zmienić wyjście.
Można dodać jedną lub więcej flag.
d Wypisanie liczby DOS-owych końców linii.
u Wypisanie liczby uniksowych końców linii.
m Wypisanie liczby macowych końców linii.
b Wypisanie znacznika BOM.
t Wypisanie, czy plik jest tekstowy, czy binarny.
c Wypisanie tylko plików, które zostałyby przekonwertowane.
Z flagą "c" dos2unix wypisze tylko pliki zawierające DOS-owe
końce linii, a unix2dos wypisze tylko nazwy plików zawierających
uniksowe końce linii.
Przykłady:
Pokazanie informacji o wszystkich plikach *.txt:
dos2unix -i *.txt
Pokazanie tylko liczby DOS-owych i uniksowych końców linii:
dos2unix -idu *.txt
Pokazanie tylko znacznika BOM:
dos2unix --info=b *.txt
Wypisanie listy plików zawierających DOS-owe końce linii:
dos2unix -ic *.txt
Wypisanie listy plików zawierających uniksowe końce linii:
unix2dos -ic *.txt
-k, --keepdate
Zachowanie znacznika czasu pliku wyjściowego takiego samego, jak
pliku wejściowego.
-L, --license
Wyświetlenie licencji programu.
-l, --newline
Dodanie dodatkowego znaku końca linii.
dos2unix: tylko DOS-owe znaki końca linii są zamieniane na dwa
uniksowe. W trybie Mac tylko macowe znaki końca linii są zamieniane
na dwa uniksowe.
unix2dos: tylko uniksowe znaki końca linii są zamieniane na dwa
DOS-owe. W trybie Mac uniksowe znaki końca linii są zamieniane na
dwa macowe.
-m, --add-bom
Zapisanie znacznika BOM (Byte Order Mark) w pliku wyjściowym.
Domyślnie zapisywany jest BOM UTF-8.
Jeśli plik wejściowy jest w kodowaniu UTF-16 i użyto opcji "-u",
zostanie zapisany BOM UTF-16.
Nigdy nie należy używać tej opcji, jeśli kodowanie wyjściowe jest
inne niż UTF-8 lub UTF-16. Więcej w sekcji UNICODE.
-n, --newfile PLIK_WEJ PLIK_WYJ ...
Tryb nowego pliku. Konwersja PLIKU_WEJ z zapisem wyjścia do
PLIKU_WYJ. Nazwy plików muszą być podane parami, a masek *nie*
należy używać, gdyż *spowoduje* to utratę plików.
Osoba uruchamiająca konwersję w trybie nowego pliku (par) będzie
właścicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego
pliku będą pochodziły z praw pliku oryginalnego po odjęciu umask(1)
osoby uruchamiającej konwersję.
-o, --oldfile PLIK ...
Tryb starego pliku. Konwersja PLIKU i nadpisanie go wyjściem.
Program działa domyślnie w tym trybie. Można używać masek.
W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje
tego samego właściciela, grupę oraz prawa odczytu/zapisu, jak plik
oryginalny - także wtedy, gdy plik jest konwertowany przez innego
użytkownika, mającego prawo zapisu do pliku (np. przez użytkownika
root). Konwersja zostanie przerwana, jeśli nie będzie możliwe
zachowanie oryginalnych wartości. Zmiana właściciela mogłaby
oznaczać, że pierwotny właściciel nie może już odczytać pliku.
Zmiana grupy mogłaby być zagrożeniem bezpieczeństwa, plik mógłby być
czytelny dla nie zamierzonych osób. Zachowanie właściciela, grupy i
praw odczytu/zapisu jest obsługiwane tylko na Uniksie.
-q, --quiet
Tryb cichy. Pominięcie wszystkich ostrzeżeń i komunikatów. Zwracanym
kodem jest zero, chyba że podano błędne opcje linii poleceń.
-r, --remove-bom
Usunięcie znaków BOM (Byte Order Mark). Bez zapisywania BOM do pliku
wyjściowego. Jest to domyślne zachowanie przy konwersji na uniksowe
końce linii. P. także opcja "-b".
-s, --safe
Pominięcie plików binarnych (domyślne).
-u, --keep-utf16
Zachowanie oryginalnego kodowania pliku wejściowego UTF-16. Plik
wyjściowy zostanie zapisany w tym samym kodowaniu UTF-16 (little lub
big endian), co plik wejściowy. Zapobiega to przekształceniu do
UTF-8. Do pliku zostanie zapisany odpowiedni znacznik BOM UTF-16. Tę
opcję można wyłączyć opcją "-ascii".
-ul, --assume-utf16le
Przyjęcie, że format pliku wejściowego to UTF-16LE.
Jeśli w pliku wejściowym jest znacznik BOM (Byte Order Mark), ma on
priorytet nad tą opcją.
Jeśli przyjęto błędne założenie (plik wejściowy nie jest w formacie
UTF-16LE), a konwersja się uda, wynikiem będzie plik wyjściowy UTF-8
ze złym tekstem. Konwersję tę można odwrócić przy użyciu polecenia
iconv(1) do konwersji wyjścia UTF-8 z powrotem do UTF-16LE.
Przywróci to plik oryginalny.
Przyjęcie UTF-16LE działa jako *tryb konwersji*. Przy przełączeniu
na domyślny tryb *ascii* przyjęcie UTF-16LE jest wyłączane.
-ub, --assume-utf16be
Przyjęcie, że format pliku wejściowego to UTF-16BE.
Ta opcja działa analogicznie do "-ul".
-v, --verbose
Wyświetlanie szczegółowych komunikatów. Wyświetlane śa dodatkowe
informacje o znacznikach BOM (Byte Order Mark) oraz liczbie
przekonwertowanych końców linii.
-F, --follow-symlink
Podążanie za dowiązaniami symbolicznymi i konwertowanie ich celów
-R, --replace-symlink
Zastępowanie dowiązań symbolicznych przekonwertowanymi plikami
(oryginalne pliki docelowe pozostają bez zmian).
-S, --skip-symlink
Pozostawienie dowiązań symbolicznych i celów bez zmian (domyślne).
-V, --version
Wyświetlenie informacji o wersji i zakończenie.
TRYB MAC
W zwykłym trybie znaki końca linii są konwertowane z DOS-a do Uniksa i
odwrotnie. Znaki końca linii systemu Mac nie są konwertowane.
W trybie Mac znaki końca linii są konwertowane z formatu Maca do Uniksa
i odwrotnie. Znaki końca linii systemu DOS nie są zmieniane.
Aby uruchomić program w trybie Mac, należy użyć opcji linii poleceń "-c
mac" albo użyć poleceń "mac2unix" lub "unix2mac".
TRYBY KONWERSJI
ascii
W trybie "ascii" konwertowane są tylko końce linii. Jest to domyślny
tryb konwersji.
Mimo że nazwa tego trybu to ASCII, które jest standardem 7-bitowym,
jest to tryb 8-bitowy. Należy zawsze używać tego trybu przy
konwersji plików Unicode UTF-8.
7bit
W tym trybie wszystkie znaki 8-bitowe spoza ASCII (o wartościach od
128 do 255) są konwertowane do przestrzeni 7-bitowej.
iso W tym trybie znaki są konwertowane między zestawem znaków DOS
(stroną kodową) a zestawem znaków ISO-8859-1 (Latin-1) używanym na
Uniksie. Znaki DOS-owe nie mające odpowiednika w ISO-8859-1, których
nie da się przekonwertować, są zamieniane na kropkę. To samo dotyczy
znaków ISO-8859-1 bez odpowiednika w DOS-ie.
Jeśli używana jest tylko opcja "-iso", dos2unix próbuje wykryć
aktywną stronę kodową. Jeśli nie jest to możliwe, dos2unix używa
domyślnej strony kodowej CP437, stosowanej głównie w USA. Aby
wymusić określoną stronę kodową, należy użyć opcji -437 (US), -850
(zachodnioeuropejska), -860 (portugalska), -863 (kanadyjska
francuska) lub -865 (nordycka). Ponadto obsługiwana jest strona
kodowa Windows CP1252 (zachodnioeuropejska) przy użyciu opcji -1252.
W przypadku innych stron kodowych można użyć narzędzia dos2unix wraz
z iconv(1). Iconv potrafi konwertować między wieloma kodowaniami
znaków.
Nigdy nie należy używać konwersji ISO na plikach tekstowych w
Unicode. Uszkodziłaby pliki kodowane UTF-8.
Kilka przykładów:
Konwersja z domyślnej strony kodowej DOS do uniksowego Latin-1:
dos2unix -iso -n in.txt out.txt
Konwersja ze strony kodowej DOS CP850 do uniksowego Latin-1:
dos2unix -850 -n in.txt out.txt
Konwersja ze strony kodowej Windows CP1252 do uniksowego Latin-1:
dos2unix -1252 -n in.txt out.txt
Konwersja ze strony kodowej Windows CP1252 do uniksowego UTF-8
(Unicode):
iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt
Konwersa z uniksowego Latin-1 do domyślnej strony kodowej DOS:
unix2dos -iso -n in.txt out.txt
Konwersja z uniksowego Latin-1 do strony kodowej DOS CP850:
unix2dos -850 -n in.txt out.txt
Konwersja z uniksowego Latin-1 do strony kodowej Windows CP1252:
unix2dos -1252 -n in.txt out.txt
Konwersja z uniksowego UTF-8 (Unicode) do strony kodowej Windows
CP1252:
unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt
Więcej pod adresem <http://czyborra.com/charsets/codepages.html>
oraz <http://czyborra.com/charsets/iso8859.html>.
UNICODE
Kodowania
Istnieją różne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode
są zwykle kodowane z użyciem UTF-8. Pod Windows pliki tekstowe Unicode
mogą być kodowane w UTF-8, UTF-16, UTF-16 big-endian, ale przeważnie są
kodowane w UTF-16.
Konwersje
Pliki tekstowe Unicode mogą mieć znaki końca linii systemu DOS, Unix lub
Mac, podobnie jak zwykłe pliki tekstowe.
Wszystkie wersje dos2unix i unix2dos potrafią konwertować pliki kodowane
UTF-8, ponieważ UTF-8 jest wstecznie zgodne z ASCII.
Dos2unix i unix2dos z obsługą Unicode UTF-16 potrafią odczytywać pliki
tekstowe kodowane UTF-16 little- oraz big-endian. Aby sprawdzić, czy
dos2unix został zbudowany z obsługą UTF-16, należy napisać "dos2unix
-V".
Pod Uniksem/Linuksem pliki w kodowaniu UTF-16 są konwertowane do
kodowania znaków ustawionej lokalizacji. Kodowanie znaków dla
lokalizacji można sprawdzić poleceniem locale(1). Jeśli konwersja nie
jest możliwa, wystąpi błąd, a plik zostanie pominięty.
Pod Windows pliki UTF-16 są domyślnie konwertowane do UTF-8. Pliki
tekstkowe w kodowaniu UTF-8 są dobrze obsługiwane zarówno pod Windows,
jak i Uniksem/Linuksem.
Kodowania UTF-16 i UTF-8 są w pełni zgodne, konwersja nie spowoduje
utraty żadnej części tekstu. W przypadku wystąpienia błędu konwersji, na
przykład w przypadku błędu w pliku wejściowym UTF-16, plik zostanie
pominięty.
W przypadku użycia opcji "-u", plik wejściowy zostanie zapisany w tym
samym kodowaniu UTF-16, co plik wejściowy. Opcja "-u" zapobiega
konwersji do UTF-8.
Dos2unix oraz unix2dos nie mają opcji pozwalającej na konwersję plików
UTF-8 do UTF-16.
Tryby konwersji ISO i 7-bit nie działają na plikach UTF-16.
Znacznik BOM
W systemie Windows pliki tekstowe zwykle zawierają znacznik BOM (Byte
Order Mark), ponieważ wiele programów dla Windows (w tym Notepad) dodaje
domyślnie znaczniki BOM. Więcej informacji można znaleźć pod adresem
<http://pl.wikipedia.org/wiki/BOM_(informatyka)>.
Pod Uniksem pliki Unicode zwykle nie mają znacznika BOM. Pliki tekstowe
są traktowane jako kodowane zgodnie z kodowaniem znaków ustawionej
lokalizacji.
Dos2unix potrafi wykryć tylko, czy plik jest w formacie UTF-16, jeśli
zawiera znacznik BOM. Jeśli plik UTF-16 nie ma tego znacznika, dos2unix
potraktuje plik jako binarny.
Do konwersji pliku UTF-16 bez znacznika BOM można użyć opcji "-ul" lub
"-ub".
Dos2unix nie zapisuje domyślnie znaku BOM w pliku wyjściowym. Z opcją
"-b" Dos2unix zapisuje BOM, jeśli plik wejściowy zawiera BOM.
Unix2dos domyślnie zapisuje znaczniki BOM w pliku wyjściowym, jeśli plik
wejściowy ma BOM. Aby usunąć BOM, można użyć opcji "-r".
Dos2unix oraz unix2dos zawsze zapisują znaczniki BOM, jeśli użyta
zostanie opcja "-m".
Przykłady Unicode
Konwersja pliku UTF-16 (z BOM) z formatu Windows do uniksowego UTF-8:
dos2unix -n in.txt out.txt
Konwersja pliku UTF-16LE (bez BOM) z formatu Windows do uniksowego
UTF-8:
dos2unix -ul -n in.txt out.txt
Konwersja z uniksowego UTF-8 do UTF-8 z BOM dla Windows:
unix2dos -m -n in.txt out.txt
Konwersja z uniksowego UTF-8 do UTF-16 dla Windows:
unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt
GB18030
GB18030 to standard urzędowy w Chinach. Obowiązkowy podzbiór standardu
GB18030 jest oficjalnym wymaganiem każdego oprogramowania sprzedawanego
w Chinach. Więcej pod adresem <http://en.wikipedia.org/wiki/GB_18030>.
GB18030 jest w pełni zgodny z Unicode i może być uważany za format
transformacji unikodu. Podobnie jak UTF-8, GB18030 jest zgodny z ASCII.
Jest także zgodny ze stroną kodową Windows 936, znaną też jako GBK.
Pod Uniksem/Linuksem pliki UTF-16 są konwertowane do GB18030, jeśli
kodowanie dla lokalizacji jest ustawione na GB18030. Uwaga: będzie to
działać tylko dla lokalizacji chińskiej. W przypadku np. ustawienia
lokalizacji angielskiej/brytyjskiej "en_GB.GB18030" konwersja UTF-16 do
GB18030 nie będzie działać, a dla lokalizacji chińskiej "zh_CN.GB18030"
będzie.
Pod Windows w celu konwersji plików UTF-16 do GB18030 należy użyć opcji
"-gb".
Pliki w kodowaniu GB18030 mogą mieć znacznik BOM, podobnie jak pliki w
Unicode.
PRZYKŁADY
Odczyt ze standardowego wejścia i zapis na standardowe wyjście:
dos2unix
dos2unix -l -c mac
Konwersja i zastąpienie a.txt; konwersja i zastąpienie b.txt:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Konwersja i zastąpienie a.txt w trybie ascii:
dos2unix a.txt
Konwersja i zastąpienie a.txt w trybie ascii; konwersja i zastąpienie
b.txt w trybie 7-bitowym:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Konwersja a.txt z formatu Mac do formatu uniksowego:
dos2unix -c mac a.txt
mac2unix a.txt
Konwersja a.txt z formatu uniksowego do formatu Mac:
unix2dos -c mac a.txt
unix2mac a.txt
Konwersja i zastąpienie a.txt z zachowaniem oryginalnego znacznika
czasu:
dos2unix -k a.txt
dos2unix -k -o a.txt
Konwersja a.txt i zapis do e.txt:
dos2unix -n a.txt e.txt
Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt
takiego, jak a.txt:
dos2unix -k -n a.txt e.txt
Konwersja i zastąpienie a.txt; konwersja b.txt i zapis do e.txt:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Konwersja c.txt i zapis do e.txt; konwersja i zastąpienie a.txt;
konwersja i zastąpienie b.txt; konwersja d.txt i zapis do f.txt:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
KONWERSJA REKURENCYJNA
Można użyć dos2unix w połączeniu z poleceniami find(1) i xargs(1) do
rekurencyjnej konwersji plików tekstowych w strukturze drzewa katalogów.
Na przykład, aby przekonwertować wszystkie pliki .txt w drzewie
katalogów poniżej katalogu bieżącego, należy napisać:
find . -name *.txt |xargs dos2unix
LOKALIZACJA
LANG
Główny język wybiera się zmienną środowiskową LANG. Zmienna LANG
składa się z kilku części. Pierwsza część to małe litery oznaczające
kod języka. Druga część jest opcjonalna i zawiera kod kraju pisany
wielkimi literami, poprzedzony podkreśleniem. Jest także opcjonalna
trzecia część: kodowanie znaków, poprzedzone kropką. Kilka
przykładów dla powłok zgodnych ze standardem POSIX:
export LANG=nl holenderski
export LANG=nl_NL holenderski, Holandia
export LANG=nl_BE holenderski, Belgia
export LANG=es_ES hiszpański, Hiszpania
export LANG=es_MX hiszpański, Meksyk
export LANG=en_US.iso88591 angielski, USA, kodowanie Latin-1
export LANG=en_GB.UTF-8 angielski, Wlk. Brytania, kodowanie UTF-8
Pełną listę kodów języków i krajów można znaleźć w podręczniku do
gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
W systemach uniksowych do uzyskania informacji dotyczących
lokalizacji można użyć polecenia locale(1).
LANGUAGE
Przy użyciu zmiennej środowiskowej LANGUAGE można określić listę
języków wg priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje
pierwszeństwo zmiennej LANGUAGE nad LANG. Na przykład, najpierw
holenderski, następnie niemiecki: "LANGUAGE=nl:de". Aby skorzystać z
listy wg priorytetów ze zmiennej LANGUAGE, trzeba najpierw włączyć
lokalizację przez ustawienie zmiennej LANG (lub LC_ALL) na wartość
inną niż "C". Więcej informacji znajduje się w podręczniku do
gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
W przypadku wybrania niedostępnego języka, otrzymamy standardowe,
angielskie komunikaty.
DOS2UNIX_LOCALEDIR
Przy użyciu zmiennej środowiskowej DOS2UNIX_LOCALEDIR, można
nadpisać ustawienie LOCALEDIR z czasu kompilacji. LOCALEDIR to
katalog używany do znalezienia plików lokalizacji. Domyślną
wartością dla GNU jest "/usr/local/share/locale". Opcja --version
wyświetla używaną wartość LOCALEDIR.
Przykład (dla powłoki POSIX):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
WARTOŚĆ ZWRACANA
W przypadku powodzenia zwracane jest zero. Jeśli wystąpi błąd systemowy,
zwracany jest ostatni błąd systemowy. W przypadku innych błędów zwracane
jest 1.
Wartość zwracana w trybie cichym to zawsze zero, z wyjątkiem sytuacji
podania błędnych opcji linii poleceń.
STANDARDY
<http://pl.wikipedia.org/wiki/Plik_tekstowy>
<http://en.wikipedia.org/wiki/Carriage_return>
<http://pl.wikipedia.org/wiki/End-of-line>
<http://pl.wikipedia.org/wiki/Unicode>
AUTORZY
Benjamin Lin <blin@socs.uts.edu.au>; Bernd Johannes Wuebben (tryb
mac2unix) <wuebben@kde.org>; Christian Wurll (dodawanie dodatkowej nowej
linii) <wurll@ira.uka.de>; Erwin Waterlander <waterlan@xs4all.nl>
(prowadzący)
Strona projektu: <http://waterlan.home.xs4all.nl/dos2unix.html>
Strona SourceForge: <http://sourceforge.net/projects/dos2unix/>
ZOBACZ TAKŻE
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - Conversor de formato de arquivo texto de DOS/Mac para Unix e vice-versa</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#NOME">NOME</a></li>
<li><a href="#SINOPSE">SINOPSE</a></li>
<li><a href="#DESCRIO">DESCRI&Ccedil;&Atilde;O</a></li>
<li><a href="#OPES">OP&Ccedil;&Otilde;ES</a></li>
<li><a href="#MODO-MAC">MODO MAC</a></li>
<li><a href="#MODOS-DE-CONVERSO">MODOS DE CONVERS&Atilde;O</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#Codificaes">Codifica&ccedil;&otilde;es</a></li>
<li><a href="#Converso">Convers&atilde;o</a></li>
<li><a href="#Marca-de-ordem-de-byte">Marca de ordem de byte</a></li>
<li><a href="#Exemplos-de-Unicode">Exemplos de Unicode</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#EXEMPLOS">EXEMPLOS</a></li>
<li><a href="#Converso-recursiva">Convers&atilde;o recursiva</a></li>
<li><a href="#LOCALIZAO">LOCALIZA&Ccedil;&Atilde;O</a></li>
<li><a href="#VALOR-RETORNADO">VALOR RETORNADO</a></li>
<li><a href="#PADRES">PADR&Otilde;ES</a></li>
<li><a href="#AUTORES">AUTORES</a></li>
<li><a href="#Veja-tambm">Veja tamb&eacute;m</a></li>
</ul>
<h1 id="NOME">NOME</h1>
<p>dos2unix - Conversor de formato de arquivo texto de DOS/Mac para Unix e vice-versa</p>
<h1 id="SINOPSE">SINOPSE</h1>
<pre><code> dos2unix [op&ccedil;&otilde;es] [ARQUIVO ...] [-n ARQENT ARQSA&Iacute;DA ...]
unix2dos [op&ccedil;&otilde;es] [ARQUIVO ...] [-n ARQENT ARQSA&Iacute;DA ...]</code></pre>
<h1 id="DESCRIO">DESCRI&Ccedil;&Atilde;O</h1>
<p>O pacote Dos2unix inclui utilit&aacute;rios de <code>dos2unix</code> e <code>unix2dos</code> para converter arquivos texto nos formatos DOS ou Mac para formato Unix e vice-versa.</p>
<p>Em arquivos texto DOS/Windows uma quebra de linha, tamb&eacute;m conhecida como nova linha, &eacute; uma combina&ccedil;&atilde;o de dois caracteres: um Carriage Return (CR) seguido por um Line Feed (LF). Em arquivos texto do Unix uma quebra de linha &eacute; um &uacute;nico caractere: o Line Feed (LF). Em arquivos texto do Mac, anteriores ao Mac OS X, uma quebra de linha era um &uacute;nico caractere Carriage Return (CR). Hoje em dia, Mac OS usa quebras de linha no estilo do Unix (LF).</p>
<p>Al&eacute;m das quebras de linhas, Dos2unix tamb&eacute;m pode converter as codifica&ccedil;&otilde;es de arquivos. Algumas poucas p&aacute;ginas podem ser convertidos para Latin-1 para Unix. E arquivos Unicode do Windows (UTF-16) podem ser convertidos para arquivos Unicode do Unix (UTF-8).</p>
<p>Arquivos bin&aacute;rios s&atilde;o ignorados automaticamente, a menos que a convers&atilde;o seja for&ccedil;ada.</p>
<p>Arquivos n&atilde;o regulares, tais como diret&oacute;rios e FIFOs, s&atilde;o ignorados automaticamente.</p>
<p>Liga&ccedil;&otilde;es simb&oacute;licas e seus alvos s&atilde;o por padr&atilde;o mantidas intoc&aacute;veis. Liga&ccedil;&otilde;es simb&oacute;licas podem opcionalmente ser substitu&iacute;das, ou a sa&iacute;da pode ser escrita para o alvo das liga&ccedil;&otilde;es simb&oacute;licas. N&atilde;o h&aacute; suporte &agrave;s liga&ccedil;&otilde;es simb&oacute;licas do Windows.</p>
<p>Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. H&aacute; uma diferen&ccedil;a importante em rela&ccedil;&atilde;o &agrave; vers&atilde;o original do SunOS/Solaris. Essa vers&atilde;o faz convers&atilde;o no-lugar (modo arquivo antigo) por padr&atilde;o, enquanto a vers&atilde;o original do SunOS/Solaris fornecia suporte apenas a convers&atilde;o pareada (modo de novo arquivo). Veja tamb&eacute;m as op&ccedil;&otilde;es <code>-o</code> e <code>-n</code>.</p>
<h1 id="OPES">OP&Ccedil;&Otilde;ES</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>Trata as op&ccedil;&otilde;es seguintes como nomes de arquivos. Use essa op&ccedil;&atilde;o se voc&ecirc; quiser converter arquivos cujos nomes iniciam com um tra&ccedil;o. Por exemplo, para converter um arquivo chamado &quot;foo&quot;, voc&ecirc; pode usar este comando:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>Ou em modo de novo arquivo:</p>
<pre><code> dos2unix -n -- -foo sa&iacute;da.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>Converte apenas as quebras de linhas. Esse &eacute; o modo de convers&atilde;o padr&atilde;o.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>Convers&atilde;o entre conjunto de caractere do DOS e ISO-8859-1. Veja tamb&eacute;m a se&ccedil;&atilde;o MODOS DE CONVERS&Atilde;O.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 1252 do Windows (Europa ocidental).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 437 do DOS (EUA). Essa &eacute; a p&aacute;gina de c&oacute;digo padr&atilde;o usada para convers&atilde;o ISO.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 850 do DOS (Europa ocidental).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 860 do DOS (Portugu&ecirc;s).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 863 do DOS (Franc&ecirc;s do Canad&aacute;).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>Usa a p&aacute;gina de c&oacute;digo 865 do DOS (N&oacute;rdico).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>Converte caracteres de 8 bit para espa&ccedil;o de 7 bit.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>Mant&eacute;m marca de ordem de bytes (BOM). Quando o arquivo de entrada possuir um BOM, escreve um BOM no arquivo de sa&iacute;da. Esse &eacute; o comportamento padr&atilde;o ao converter para quebras de linha do DOS. Veja tamb&eacute;m a op&ccedil;&atilde;o <code>-r</code>.</p>
</dd>
<dt id="c---convmode-MODOCONV"><b>-c, --convmode MODOCONV</b></dt>
<dd>
<p>Define o modo de convers&atilde;o, sendo MODOCONV um dentre: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i> com ascii sendo o padr&atilde;o.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>For&ccedil;a a convers&atilde;o de arquivos bin&aacute;rios.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>No Windows, arquivos UTF-16 s&atilde;o convertidos, por padr&atilde;o, para UTF-8, independentemente da localiza&ccedil;&atilde;o definida. Use esta op&ccedil;&atilde;o para converter arquivos UTF-16 para GB18030. Essa op&ccedil;&atilde;o est&aacute; dispon&iacute;vel apenas no Windows. Veja tamb&eacute;m a se&ccedil;&atilde;o GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>Exibe ajuda e sai.</p>
</dd>
<dt id="i-OPES---info-OPES-ARQUIVO"><b>-i[OP&Ccedil;&Otilde;ES], --info[=OP&Ccedil;&Otilde;ES] ARQUIVO ...</b></dt>
<dd>
<p>Exibe informa&ccedil;&atilde;o do arquivo. Nenhuma convers&atilde;o &eacute; feita.</p>
<p>A seguinte informa&ccedil;&atilde;o &eacute; exibida, nesta ordem: n&uacute;mero de quebras de linha do DOS, n&uacute;mero de quebras de linha do Unix, n&uacute;mero de quebras de linha do Mac, marca de ordem de byte, &quot;text&quot; ou &quot;bin&aacute;rio&quot;, nome de arquivo.</p>
<p>Sa&iacute;da de exemplo:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>Opcionalmente, op&ccedil;&otilde;es extra podem ser definidas para alterar a sa&iacute;da. Uma ou mais op&ccedil;&otilde;es podem ser adicionadas.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>Exibe o n&uacute;mero de quebras de linhas do DOS.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>Exibe o n&uacute;mero de quebras de linhas do Unix.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>Exibe o n&uacute;mero de quebras de linhas do Mac.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>Exibe a marca de ordem de byte.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>Exibe se arquivo &eacute; texto ou bin&aacute;rio.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>Exib apenas os arquivos que seriam convertidos.</p>
<p>Com a op&ccedil;&atilde;o <code>c</code>, dos2unix vai exibir apenas os arquivos que cont&ecirc;m quebras de linha do DOS, unix2dos vai exibir apenas os nomes de arquivos que cont&ecirc;m quebras de linha do Unix.</p>
</dd>
</dl>
<p>Exemplos:</p>
<p>Mostra informa&ccedil;&atilde;o sobre todos os arquivos *.txt:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>Mostra apenas o n&uacute;mero de quebras de linha DOS e Unix:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>Mostra apenas a marca de ordem de byte:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>Lista os arquivos que possuem quebras de linha do DOS:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>Lista os arquivos que possuem quebras de linha do Unix:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>Mant&eacute;m a marca da data do arquivo de sa&iacute;da igual ao do arquivo de entrada.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>Exibe a licen&ccedil;a do programa.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>Adiciona nova linha adicional.</p>
<p><b>dos2unix</b>: Apenas quebras de linha do DOS s&atilde;o alteradas para duas quebras de linha do Unix. No modo Mac, apenas quebras de linha do Mac s&atilde;o alterados para duas quebras de linha do Unix.</p>
<p><b>unix2dos</b>: Apenas quebras de linha do Unix s&atilde;o alteradas para duas quebras de linha do DOS. No modo Mac, quebras de linha do Unix s&atilde;o alteradas para duas quebras de linha do Mac.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>Escreve uma marca de ordem de byte (BOM) no arquivo de sa&iacute;da. Por padr&atilde;o, um BOM UTF-8 &eacute; escrito.</p>
<p>Quando o arquivo de entrada &eacute; UTF-16, e a op&ccedil;&atilde;o <code>-u</code> &eacute; usada, um BOM UTF-16 ser&aacute; escrito.</p>
<p>Nunca use essa op&ccedil;&atilde;o quando a codifica&ccedil;&atilde;o de sa&iacute;da &eacute; outra al&eacute;m de UTF-8 ou UTF-16. Veja tamb&eacute;m a se&ccedil;&atilde;o UNICODE.</p>
</dd>
<dt id="n---newfile-ARQENT-ARQSADA"><b>-n, --newfile ARQENT ARQSA&Iacute;DA ...</b></dt>
<dd>
<p>Modo de novo arquivo. Converte o arquivo ARQENT e escreve a sa&iacute;da para o arquivo ARQSA&Iacute;DA. Os nomes de arquivos devem ser fornecidos em pares e nome coringa <i>n&atilde;o</i> deveriam ser usados ou voc&ecirc; <i>vai</i> perder seus arquivos.</p>
<p>A pessoa que come&ccedil;a a convers&atilde;o em modo novo arquivo (pareado) ser&aacute; o dono do arquivo convertido. As permiss&otilde;es de leitura/escrita do novo arquivo ser&atilde;o as permiss&otilde;es do arquivo original menos a umask(1) da pessoa que executa a convers&atilde;o.</p>
</dd>
<dt id="o---oldfile-ARQUIVO"><b>-o, --oldfile ARQUIVO ...</b></dt>
<dd>
<p>Modo arquivo antigo. Converte o arquivo ARQUIVO e o sobrescreve com a sa&iacute;da. O programa, por padr&atilde;o, executa neste modo. Nomes coringas podem ser usados.</p>
<p>No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no mesmo dono, grupo e permiss&otilde;es de leitura/escrita que o arquivo original. Tamb&eacute;m, quando o arquivo &eacute; convertido por outro usu&aacute;rio que tenha permiss&otilde;es de escrita no arquivo (ex.: usu&aacute;rio root). A convers&atilde;o ser&aacute; abortada quando n&atilde;o for poss&iacute;vel preservar os valores originais. Altera&ccedil;&atilde;o do dono pode significar que o dono original n&atilde;o &eacute; mais capaz de ler o arquivo. Altera&ccedil;&atilde;o do grupo pode ser um risco para a seguran&ccedil;a, pois o arquivo pode ficar leg&iacute;vel para pessoas cujo acesso n&atilde;o &eacute; desejado. Preserva&ccedil;&atilde;o do dono, grupo e permiss&otilde;es de leitura/escrita tem suporte apenas no Unix.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Modo quieto. Suprime todos os avios e mensagens. O valor retornado &eacute; zero. Exceto quando op&ccedil;&otilde;es de linha de comando erradas forem usadas.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>remove marca de ordem de bytes (BOM). N&atilde;o escreve um BOM no arquivo de sa&iacute;da. Esse &eacute; o comportamento padr&atilde;o ao converter para quebras de linha Unix. Veja tamb&eacute;m a op&ccedil;&atilde;o <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>Ignora arquivo bin&aacute;rios (padr&atilde;o).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>Mant&eacute;m a codifica&ccedil;&atilde;o UTF-16 original do arquivo de entrada. O arquivo de sa&iacute;da ser&aacute; escrito na mesma codifica&ccedil;&atilde;o UTF-16, em little ou big endian, como o arquivo de entrada. Isso evita transforma&ccedil;&atilde;o para UTF-8. Como consequ&ecirc;ncia, um BOM UTF-16 ser&aacute; escrito. Essa op&ccedil;&atilde;o pode ser desabilitada com a op&ccedil;&atilde;o <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>Presume que o formato de arquivo de entrada &eacute; UTF-16LE.</p>
<p>Quando h&aacute; uma marca de ordem de byte no arquivo de entrada, esta tem prioridade sobre essa op&ccedil;&atilde;o.</p>
<p>Quando voc&ecirc; fizer uma presun&ccedil;&atilde;o equivocada (o arquivo de entrada n&atilde;o estava no formato UTF-16LE) e a convers&atilde;o funcionar, voc&ecirc; ter&aacute; um arquivo de sa&iacute;da UTF-8 com texto errado. Voc&ecirc; pode desfazer a convers&atilde;o errada com iconv(1) pela convers&atilde;o do arquivo de sa&iacute;da UTF-8 de volta para UTF-16LE. Isso vai trazer de volta o arquivo para o original.</p>
<p>A presun&ccedil;&atilde;o de UTF-16LE funciona como um <i>modo de convers&atilde;o</i>. Ao alternara o modo <i>ascii</i> padr&atilde;o, a presun&ccedil;&atilde;o de UTF-16LE &eacute; desativada.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>Presume que o formato de arquivo de entrada &eacute; UTF-16BE.</p>
<p>Essa op&ccedil;&atilde;o funciona o mesmo que a op&ccedil;&atilde;o <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>Exibe mensagens detalhadas. Informa&ccedil;&atilde;o extra &eacute; exibida sobre marcas de ordem de byte e a quantidade de quebras de linha convertidas.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>Segue liga&ccedil;&otilde;es simb&oacute;licas e converte os alvos.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>Substitui liga&ccedil;&otilde;es simb&oacute;licas com arquivos convertidos (arquivos alvo originais permanecem inalterados).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>Ment&eacute;m liga&ccedil;&otilde;es simb&oacute;licas e alvos inalterados (padr&atilde;o).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>Exibe informa&ccedil;&atilde;o da vers&atilde;o e sai.</p>
</dd>
</dl>
<h1 id="MODO-MAC">MODO MAC</h1>
<p>No modo normal, as quebras de linhas s&atilde;o convertidas de DOS para Unix e vice-versa. Quebras de linha do Mac n&atilde;o s&atilde;o convertidas.</p>
<p>No modo Mac, quebras de linha s&atilde;o convertidas de Mac para Unix e vice-versa. Quebras de linha do DOS n&atilde;o s&atilde;o alteradas.</p>
<p>Para executar no modo Mac, use a op&ccedil;&atilde;o de linha de comando <code>-c mac</code> ou use os comandos <code>mac2unix</code> ou <code>unix2mac</code>.</p>
<h1 id="MODOS-DE-CONVERSO">MODOS DE CONVERS&Atilde;O</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>No modo <code>ascii</code>, apenas as quebras de linha s&atilde;o convertidas. Esse &eacute; o modo de convers&atilde;o padr&atilde;o.</p>
<p>Apesar do nome deste modo ser ASCII, o qual &eacute; um padr&atilde;o de 7 bit, o modo &eacute; em verdade 8 bit. Sempre use este modo quando quiser converter arquivos Unicode UTF-8.</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>Neste modo todos os caracteres n&atilde;o-ASCII de 8 bit (com valores entre 128 e 255) s&atilde;o convertidos para um espa&ccedil;o de 7 bit.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>Caracteres s&atilde;o convertidos entre um conjunto de caracteres do DOS (p&aacute;gina de c&oacute;digo) e conjunto de caracteres ISO-8859-1 (Latin-1) no Unix. Caracteres de DOS sem um equivalente ISO-8859-1, para os quais a convers&atilde;o n&atilde;o &eacute; poss&iacute;vel, s&atilde;o convertidos para um ponto. O mesmo vale para caracteres ISO-8859-1 sem a contraparte DOS.</p>
<p>Quando apenas a op&ccedil;&atilde;o <code>-iso</code> for usada, dos2unix vai tentar determinar a p&aacute;gina de c&oacute;digo ativa. Quando isso n&atilde;o for poss&iacute;vel, dos2unix vai usar a p&aacute;gina de c&oacute;digo padr&atilde;o CP437, a qual &eacute; usada principalmente nos EUA. Para for&ccedil;ar uma p&aacute;gina de c&oacute;digo espec&iacute;fica, use as op&ccedil;&otilde;es <code>-437</code> (EUA), <code>-850</code> (Europeu oriental), <code>-860</code> (Portugu&ecirc;s), <code>-863</code> (Franco-canadense) ou <code>-865</code> (N&oacute;rdico). Tamb&eacute;m h&aacute; suporte &agrave; p&aacute;gina de c&oacute;digo do Windows CP1252 (Europeu ocidental) com a op&ccedil;&atilde;o <code>-1252</code>. Para outras p&aacute;ginas de c&oacute;digo, use dos2unix em combina&ccedil;&atilde;o cm iconv(1). Iconv pode converter entre uma lista grande de codifica&ccedil;&otilde;es de caracteres.</p>
<p>Nunca use convers&atilde;o ISO em arquivos textos Unicode. Isso vai corromper os arquivos codificados em UTF-8.</p>
<p>Alguns exemplos:</p>
<p>Convers&atilde;o da p&aacute;gina de c&oacute;digo padr&atilde;o do DOS para Latin-1 do Unix:</p>
<pre><code> dos2unix -iso -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o da CP850 do DOS para Latin-1 do Unix:</p>
<pre><code> dos2unix -850 -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o da CP1252 do Windows para Latin-1 do Unix:</p>
<pre><code> dos2unix -1252 -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o da CP1252 do Windows para UTF-8 (Unicode) do Unix:</p>
<pre><code> iconv -f CP1252 -t UTF-8 entrada.txt | dos2unix &gt; sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o de Latin-1 do Unix para p&aacute;gina de c&oacute;digo padr&atilde;o do DOS:</p>
<pre><code> unix2dos -iso -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o do Latin-1 do Unix para CP850 do DOS:</p>
<pre><code> unix2dos -850 -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o do Latin-1 do unix para CP1252 do Windows:</p>
<pre><code> unix2dos -1252 -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o do UTF-8 (Unicode) do Unix para CP1252 do Windows:</p>
<pre><code> unix2dos &lt; entrada.txt | iconv -f UTF-8 -t CP1252 &gt; sa&iacute;da.txt</code></pre>
<p>Veja tamb&eacute;m <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> e <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="Codificaes">Codifica&ccedil;&otilde;es</h2>
<p>Exitem codifica&ccedil;&otilde;es Unicode diferentes. No Unix e no Linux, arquivos Unicode s&atilde;o geralmente codificados em UTF-8. No Windows, arquivos texto Unicode podem ser codificados em UTF-8, UTF-16 ou UTF-16 big endian, mas na maioria das vezes s&atilde;o codificados no formato UTF-16.</p>
<h2 id="Converso">Convers&atilde;o</h2>
<p>Arquivos texto em Unicode pode ter quebras de linha DOS, Unix ou Mac, como arquivos texto comuns.</p>
<p>Todas as vers&otilde;es do dos2unix e unix2dos podem converter arquivos codificados em UTF-8 porque UTF-8 foi projetado para ter compatibilidade reversa com ASCII.</p>
<p>Dos2unix e unix2dos com suporte a Unicode UTF-16 podem ler arquivos texto codificados em little e big endian UTF-16. Para ver se dos2unix foi compilado com suporte a UTF-16, digite <code>dos2unix -V</code>.</p>
<p>No Unix/Linux, arquivos codificados em UTF-16 s&atilde;o convertidos para a codifica&ccedil;&atilde;o de caracteres do localiza&ccedil;&atilde;o. Use o comando locale(1) para descobrir qual &eacute; a codifica&ccedil;&atilde;o de caracteres da localiza&ccedil;&atilde;o. Quando a convers&atilde;o n&atilde;o for poss&iacute;vel, ocorrer&aacute; um erro e o arquivo ser&aacute; ignorado.</p>
<p>No Windows, arquivos UTF-16 s&atilde;o convertidos, por padr&atilde;o, para UTF-8. Arquivos texto formatados em UTF-8 possuem &oacute;timo suporte em ambos Windows e Unix/Linux.</p>
<p>Codifica&ccedil;&otilde;es UTF-16 e UTF-8 s&atilde;o completamente compat&iacute;veis, n&atilde;o havendo qualquer perda de texto na convers&atilde;o. Quando um erro de convers&atilde;o UTF-16 para UTF-8 ocorre, por exemplo quando o arquivo de entrada UTF-16 cont&eacute;m um erro, o arquivo ser&aacute; ignorado.</p>
<p>Quando a op&ccedil;&atilde;o <code>-u</code> &eacute; usada, o arquivo de sa&iacute;da ser&aacute; escrito na mesma codifica&ccedil;&atilde;o UTF-16 que o arquivo de sa&iacute;da. A op&ccedil;&atilde;o <code>-u</code> evita convers&atilde;o para UTF-8.</p>
<p>Dos2unix e unix2dos n&atilde;o possuem op&ccedil;&atilde;o para converter arquivos UTF-8 &aacute;ra UTF-16.</p>
<p>Modo de convers&atilde;o ISO e 7-bit n&atilde;o funciona em arquivos UTF-16.</p>
<h2 id="Marca-de-ordem-de-byte">Marca de ordem de byte</h2>
<p>No Windows, arquivos Unicode normalmente t&ecirc;m uma Marca de Ordem de Byte (BOM), porque muitos programas (incluindo o Bloco de Notas) adiciona BOMs por padr&atilde;o. Veja tamb&eacute;m <a href="http://en.wikipedia.org/wiki/Byte_order_mark">http://en.wikipedia.org/wiki/Byte_order_mark</a>.</p>
<p>No Unix, arquivos Unicode normalmente n&atilde;o t&ecirc;m BOM. Presume-se que arquivos texto s&atilde;o codificados na codifica&ccedil;&atilde;o de caracteres da localiza&ccedil;&atilde;o.</p>
<p>Dos2unix pode detectar apenas se um arquivo est&aacute; no formato UTF-16 se o arquivo tiver BOM. Quando um arquivo UTF-16 n&atilde;o tiver BOM, dos2unix vai ver se o arquivo &eacute; um arquivo bin&aacute;rio.</p>
<p>Use a op&ccedil;&atilde;o <code>-ul</code> ou <code>-ub</code> para converter um arquivo UTF-16 sem BOM.</p>
<p>Dos2unix escreve por padr&atilde;o nenhum BOM no arquivo de sa&iacute;da. Com a op&ccedil;&atilde;o <code>-b</code>, o Dos2unix escreve um BOM quando o arquivo de entrada possuir BOM.</p>
<p>Unix2dos escreve por padr&atilde;o um BOM no arquivo de sa&iacute;da quando o arquivo de entrada tem BOM. Use a op&ccedil;&atilde;o <code>-m</code> para remover BOM.</p>
<p>Dos2unix e unix2dos sempre escrevem BOM quando a op&ccedil;&atilde;o <code>-m</code> &eacute; usada.</p>
<h2 id="Exemplos-de-Unicode">Exemplos de Unicode</h2>
<p>Convers&atilde;o de UTF-16 do Windows (com BOM) para UTF-8 do Unix:</p>
<pre><code> dos2unix -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o de UTF-16LE do Windows (sem BOM) para UTF-8 do Unix:</p>
<pre><code> dos2unix -ul -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o de UTF-8 Unix para UTF-8 do Windows com BOM:</p>
<pre><code> unix2dos -m -n entrada.txt sa&iacute;da.txt</code></pre>
<p>Convers&atilde;o de UTF-8 do Unix para UTF-16 do Windows:</p>
<pre><code> unix2dos &lt; entrada.txt | iconv -f UTF-8 -t UTF-16 &gt; sa&iacute;da.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 &eacute; um padr&atilde;o governamental chin&ecirc;s. Um subconjunto obrigat&oacute;rio do padr&atilde;o GB18030 &eacute; exigido oficialmente para todos os produtos de software vendidos na China. Veja tamb&eacute;m <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>GB18030 &eacute; completamente compat&iacute;vel com Unicode e pode ser considerado um formato de transforma&ccedil;&atilde;o de unicode. Assim como UTF-8, GB18030 &eacute; compat&iacute;vel com ASCII. GB18030 tamb&eacute;m &eacute; compat&iacute;vel com a p&aacute;gina de c&oacute;digo 936 do Windows, tamb&eacute;m conhecida como GBK.</p>
<p>No Unix/Linux, arquivos UTF-16 s&atilde;o convertidos para GB18030 quando a codifica&ccedil;&atilde;o da localiza&ccedil;&atilde;o &eacute; definida para GB18030. Note que isso vai funcionar apenas se a localiza&ccedil;&atilde;o estiver definida para China. Por exemplo, em uma configura&ccedil;&atilde;o de localiza&ccedil;&atilde;o inglesa (Brit&acirc;nia) a convers&atilde;o <code>en_GB.GB18030</code> de UTF-16 para GB18030 n&atilde;o vai funcionar, mas em uma configura&ccedil;&atilde;o de localiza&ccedil;&atilde;o <code>zh_CN.GB18030</code> chinesa vai funcionar.</p>
<p>No Windows, voc&ecirc; precisa usar a op&ccedil;&atilde;o <code>-gb</code> para converter arquivos UTF-16 para GB18030.</p>
<p>Arquivos codificados em GB18030 possuem uma marca de ordem de bytes, como arquivos Unicode.</p>
<h1 id="EXEMPLOS">EXEMPLOS</h1>
<p>L&ecirc; a entrada da &quot;stdin&quot; e escreve a sa&iacute;da para &quot;stdout&quot;:</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>Converte e substitui a.txt. Converte e substitui b.txt:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>Converte e substitui a.txt no modo de convers&atilde;o ascii:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>Converte e substitui a.txt no modo de convers&atilde;o ascii. Converte e substitui b.txt no modo de convers&atilde;o 7bit:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>Converte a.txt do formato do Mac para Unix:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>Converte a.txt do formato do Unix para Mac:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>Converte e substitui a.txt enquanto mant&eacute;m a marca de data original:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>Converte a.txt e escreve para e.txt:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>Converte a.txt e escreve para e.txt, mant&eacute;m a marca de data de e.txt igual a a.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>Converte e substitui a.txt. Converte b.txt e escreve para e.txt:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>Converte c.txt e escreve para e.txt. Converte e substitui a.txt. Converte e substitui b.txt. Converte d.txt e escreve para f.txt:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="Converso-recursiva">Convers&atilde;o recursiva</h1>
<p>Use dos2unix em combina&ccedil;&atilde;o com os comandos find(1) e xargs(1) para converter recursivamente arquivos texto em uma estrutura de &aacute;rvore de diret&oacute;rios. Por exemplo, para converter todos os arquivos .txt na &aacute;rvore de diret&oacute;rios sob o diret&oacute;rio atual, digite:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="LOCALIZAO">LOCALIZA&Ccedil;&Atilde;O</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>O idioma prim&aacute;rio &eacute; selecionado com a vari&aacute;vel de ambiente LANG. A vari&aacute;vel LANG consiste em v&aacute;rias partes. A primeira parte est&aacute; em letras pequenas no c&oacute;digo do idioma. A segunda parte &eacute; opcional e &eacute; o c&oacute;digo do pa&iacute;s em letras mai&uacute;sculo, precedido de um ponto. Alguns exemplos para shells do tipo padr&atilde;o POSIX:</p>
<pre><code> export LANG=nl Holand&ecirc;s
export LANG=nl_NL Holand&ecirc;s, Holanda
export LANG=nl_BE Holand&ecirc;s, B&eacute;lgica
export LANG=es_ES Espanhol, Espanha
export LANG=es_MX Espanhol, M&eacute;xico
export LANG=en_US.iso88591 Ingl&ecirc;s, EUA, codifica&ccedil;&atilde;o Latin-1
export LANG=en_GB.UTF-8 Ingl&ecirc;s, Reino Unido, codifica&ccedil;&atilde;o UTF-8</code></pre>
<p>Para a lista completa de c&oacute;digos de idioma e pa&iacute;s, veja o manual do gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>Nos sistemas Unix, voc&ecirc; pode usar o comando locale(1) para obter informa&ccedil;&atilde;o espec&iacute;fica da localiza&ccedil;&atilde;o.</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>Com a vari&aacute;vel de ambiente LANGUAGE, voc&ecirc; pode especificar uma lista de prioridades de idiomas, separada por v&iacute;rgulas. Dos2unix fornece prefer&ecirc;ncia &agrave; LANGUAGE sobre LANG. Por exemplo, primeiro holand&ecirc;s e, ent&atilde;o, alem&atilde;o: <code>LANGUAGE=nl:de</code>. Voc&ecirc; primeiro tem que habilitar localiza&ccedil;&atilde;o, definindo LANG (ou LC_ALL) para um valor diferente de &quot;C&quot;, antes que voc&ecirc; possa usar uma lista de prioridade de idioma por meio da vari&aacute;vel LANGUAGE. Veja tamb&eacute;m o manual do gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>Se voc&ecirc; selecionou um idioma que n&atilde;o est&aacute; dispon&iacute;vel, voc&ecirc; vai ter&aacute; as mensagens em ingl&ecirc;s (padr&atilde;o).</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>Com a vari&aacute;vel de ambiente DOS2UNIX_LOCALEDIR, o LOCALEDIR definido durante a compila&ccedil;&atilde;o pode ser sobrescrito. LOCALEDIR &eacute; usada para localizar os arquivos de idioma. O valor padr&atilde;o do GNU &eacute; <code>/usr/local/share/locale</code>. A op&ccedil;&atilde;o <b>--version</b> vai exibir o LOCALEDIR que &eacute; usado.</p>
<p>Exemplo (shell POSIX):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="VALOR-RETORNADO">VALOR RETORNADO</h1>
<p>No sucesso, zero &eacute; retornado. Quando um erro de sistema ocorre, o &uacute;ltimo erro de sistema ser&aacute; retornado. Para outros erros, 1 &eacute; retornado.</p>
<p>O valor retornado &eacute; sempre zero no modo quieto, exceto quando op&ccedil;&otilde;es de linha de comando erradas s&atilde;o usadas.</p>
<h1 id="PADRES">PADR&Otilde;ES</h1>
<p><a href="http://en.wikipedia.org/wiki/Text_file">http://en.wikipedia.org/wiki/Text_file</a></p>
<p><a href="http://en.wikipedia.org/wiki/Carriage_return">http://en.wikipedia.org/wiki/Carriage_return</a></p>
<p><a href="http://en.wikipedia.org/wiki/Newline">http://en.wikipedia.org/wiki/Newline</a></p>
<p><a href="http://en.wikipedia.org/wiki/Unicode">http://en.wikipedia.org/wiki/Unicode</a></p>
<h1 id="AUTORES">AUTORES</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt; Bernd Johannes Wuebben (modo mac2unix) - &lt;wuebben@kde.org&gt;, Christian Wurll (adiciona nova linha extra) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (mantenedor)</p>
<p>P&aacute;gina do projeto: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>P&aacute;gina do SourceForge: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="Veja-tambm">Veja tamb&eacute;m</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,608 +0,0 @@
NOME
dos2unix - Conversor de formato de arquivo texto de DOS/Mac para Unix e
vice-versa
SINOPSE
dos2unix [opções] [ARQUIVO ...] [-n ARQENT ARQSAÍDA ...]
unix2dos [opções] [ARQUIVO ...] [-n ARQENT ARQSAÍDA ...]
DESCRIÇÃO
O pacote Dos2unix inclui utilitários de "dos2unix" e "unix2dos" para
converter arquivos texto nos formatos DOS ou Mac para formato Unix e
vice-versa.
Em arquivos texto DOS/Windows uma quebra de linha, também conhecida como
nova linha, é uma combinação de dois caracteres: um Carriage Return (CR)
seguido por um Line Feed (LF). Em arquivos texto do Unix uma quebra de
linha é um único caractere: o Line Feed (LF). Em arquivos texto do Mac,
anteriores ao Mac OS X, uma quebra de linha era um único caractere
Carriage Return (CR). Hoje em dia, Mac OS usa quebras de linha no estilo
do Unix (LF).
Além das quebras de linhas, Dos2unix também pode converter as
codificações de arquivos. Algumas poucas páginas podem ser convertidos
para Latin-1 para Unix. E arquivos Unicode do Windows (UTF-16) podem ser
convertidos para arquivos Unicode do Unix (UTF-8).
Arquivos binários são ignorados automaticamente, a menos que a conversão
seja forçada.
Arquivos não regulares, tais como diretórios e FIFOs, são ignorados
automaticamente.
Ligações simbólicas e seus alvos são por padrão mantidas intocáveis.
Ligações simbólicas podem opcionalmente ser substituídas, ou a saída
pode ser escrita para o alvo das ligações simbólicas. Não há suporte às
ligações simbólicas do Windows.
Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. Há uma
diferença importante em relação à versão original do SunOS/Solaris. Essa
versão faz conversão no-lugar (modo arquivo antigo) por padrão, enquanto
a versão original do SunOS/Solaris fornecia suporte apenas a conversão
pareada (modo de novo arquivo). Veja também as opções "-o" e "-n".
OPÇÕES
-- Trata as opções seguintes como nomes de arquivos. Use essa opção se
você quiser converter arquivos cujos nomes iniciam com um traço. Por
exemplo, para converter um arquivo chamado "foo", você pode usar
este comando:
dos2unix -- -foo
Ou em modo de novo arquivo:
dos2unix -n -- -foo saída.txt
-ascii
Converte apenas as quebras de linhas. Esse é o modo de conversão
padrão.
-iso
Conversão entre conjunto de caractere do DOS e ISO-8859-1. Veja
também a seção MODOS DE CONVERSÃO.
-1252
Usa a página de código 1252 do Windows (Europa ocidental).
-437
Usa a página de código 437 do DOS (EUA). Essa é a página de código
padrão usada para conversão ISO.
-850
Usa a página de código 850 do DOS (Europa ocidental).
-860
Usa a página de código 860 do DOS (Português).
-863
Usa a página de código 863 do DOS (Francês do Canadá).
-865
Usa a página de código 865 do DOS (Nórdico).
-7 Converte caracteres de 8 bit para espaço de 7 bit.
-b, --keep-bom
Mantém marca de ordem de bytes (BOM). Quando o arquivo de entrada
possuir um BOM, escreve um BOM no arquivo de saída. Esse é o
comportamento padrão ao converter para quebras de linha do DOS. Veja
também a opção "-r".
-c, --convmode MODOCONV
Define o modo de conversão, sendo MODOCONV um dentre: *ascii*,
*7bit*, *iso*, *mac* com ascii sendo o padrão.
-f, --force
Força a conversão de arquivos binários.
-gb, --gb18030
No Windows, arquivos UTF-16 são convertidos, por padrão, para UTF-8,
independentemente da localização definida. Use esta opção para
converter arquivos UTF-16 para GB18030. Essa opção está disponível
apenas no Windows. Veja também a seção GB18030.
-h, --help
Exibe ajuda e sai.
-i[OPÇÕES], --info[=OPÇÕES] ARQUIVO ...
Exibe informação do arquivo. Nenhuma conversão é feita.
A seguinte informação é exibida, nesta ordem: número de quebras de
linha do DOS, número de quebras de linha do Unix, número de quebras
de linha do Mac, marca de ordem de byte, "text" ou "binário", nome
de arquivo.
Saída de exemplo:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Opcionalmente, opções extra podem ser definidas para alterar a
saída. Uma ou mais opções podem ser adicionadas.
d Exibe o número de quebras de linhas do DOS.
u Exibe o número de quebras de linhas do Unix.
m Exibe o número de quebras de linhas do Mac.
b Exibe a marca de ordem de byte.
t Exibe se arquivo é texto ou binário.
c Exib apenas os arquivos que seriam convertidos.
Com a opção "c", dos2unix vai exibir apenas os arquivos que
contêm quebras de linha do DOS, unix2dos vai exibir apenas os
nomes de arquivos que contêm quebras de linha do Unix.
Exemplos:
Mostra informação sobre todos os arquivos *.txt:
dos2unix -i *.txt
Mostra apenas o número de quebras de linha DOS e Unix:
dos2unix -idu *.txt
Mostra apenas a marca de ordem de byte:
dos2unix --info=b *.txt
Lista os arquivos que possuem quebras de linha do DOS:
dos2unix -ic *.txt
Lista os arquivos que possuem quebras de linha do Unix:
unix2dos -ic *.txt
-k, --keepdate
Mantém a marca da data do arquivo de saída igual ao do arquivo de
entrada.
-L, --license
Exibe a licença do programa.
-l, --newline
Adiciona nova linha adicional.
dos2unix: Apenas quebras de linha do DOS são alteradas para duas
quebras de linha do Unix. No modo Mac, apenas quebras de linha do
Mac são alterados para duas quebras de linha do Unix.
unix2dos: Apenas quebras de linha do Unix são alteradas para duas
quebras de linha do DOS. No modo Mac, quebras de linha do Unix são
alteradas para duas quebras de linha do Mac.
-m, --add-bom
Escreve uma marca de ordem de byte (BOM) no arquivo de saída. Por
padrão, um BOM UTF-8 é escrito.
Quando o arquivo de entrada é UTF-16, e a opção "-u" é usada, um BOM
UTF-16 será escrito.
Nunca use essa opção quando a codificação de saída é outra além de
UTF-8 ou UTF-16. Veja também a seção UNICODE.
-n, --newfile ARQENT ARQSAÍDA ...
Modo de novo arquivo. Converte o arquivo ARQENT e escreve a saída
para o arquivo ARQSAÍDA. Os nomes de arquivos devem ser fornecidos
em pares e nome coringa *não* deveriam ser usados ou você *vai*
perder seus arquivos.
A pessoa que começa a conversão em modo novo arquivo (pareado) será
o dono do arquivo convertido. As permissões de leitura/escrita do
novo arquivo serão as permissões do arquivo original menos a
umask(1) da pessoa que executa a conversão.
-o, --oldfile ARQUIVO ...
Modo arquivo antigo. Converte o arquivo ARQUIVO e o sobrescreve com
a saída. O programa, por padrão, executa neste modo. Nomes coringas
podem ser usados.
No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no
mesmo dono, grupo e permissões de leitura/escrita que o arquivo
original. Também, quando o arquivo é convertido por outro usuário
que tenha permissões de escrita no arquivo (ex.: usuário root). A
conversão será abortada quando não for possível preservar os valores
originais. Alteração do dono pode significar que o dono original não
é mais capaz de ler o arquivo. Alteração do grupo pode ser um risco
para a segurança, pois o arquivo pode ficar legível para pessoas
cujo acesso não é desejado. Preservação do dono, grupo e permissões
de leitura/escrita tem suporte apenas no Unix.
-q, --quiet
Modo quieto. Suprime todos os avios e mensagens. O valor retornado é
zero. Exceto quando opções de linha de comando erradas forem usadas.
-r, --remove-bom
remove marca de ordem de bytes (BOM). Não escreve um BOM no arquivo
de saída. Esse é o comportamento padrão ao converter para quebras de
linha Unix. Veja também a opção "-b".
-s, --safe
Ignora arquivo binários (padrão).
-u, --keep-utf16
Mantém a codificação UTF-16 original do arquivo de entrada. O
arquivo de saída será escrito na mesma codificação UTF-16, em little
ou big endian, como o arquivo de entrada. Isso evita transformação
para UTF-8. Como consequência, um BOM UTF-16 será escrito. Essa
opção pode ser desabilitada com a opção "-ascii".
-ul, --assume-utf16le
Presume que o formato de arquivo de entrada é UTF-16LE.
Quando há uma marca de ordem de byte no arquivo de entrada, esta tem
prioridade sobre essa opção.
Quando você fizer uma presunção equivocada (o arquivo de entrada não
estava no formato UTF-16LE) e a conversão funcionar, você terá um
arquivo de saída UTF-8 com texto errado. Você pode desfazer a
conversão errada com iconv(1) pela conversão do arquivo de saída
UTF-8 de volta para UTF-16LE. Isso vai trazer de volta o arquivo
para o original.
A presunção de UTF-16LE funciona como um *modo de conversão*. Ao
alternara o modo *ascii* padrão, a presunção de UTF-16LE é
desativada.
-ub, --assume-utf16be
Presume que o formato de arquivo de entrada é UTF-16BE.
Essa opção funciona o mesmo que a opção "-ul".
-v, --verbose
Exibe mensagens detalhadas. Informação extra é exibida sobre marcas
de ordem de byte e a quantidade de quebras de linha convertidas.
-F, --follow-symlink
Segue ligações simbólicas e converte os alvos.
-R, --replace-symlink
Substitui ligações simbólicas com arquivos convertidos (arquivos
alvo originais permanecem inalterados).
-S, --skip-symlink
Mentém ligações simbólicas e alvos inalterados (padrão).
-V, --version
Exibe informação da versão e sai.
MODO MAC
No modo normal, as quebras de linhas são convertidas de DOS para Unix e
vice-versa. Quebras de linha do Mac não são convertidas.
No modo Mac, quebras de linha são convertidas de Mac para Unix e
vice-versa. Quebras de linha do DOS não são alteradas.
Para executar no modo Mac, use a opção de linha de comando "-c mac" ou
use os comandos "mac2unix" ou "unix2mac".
MODOS DE CONVERSÃO
ascii
No modo "ascii", apenas as quebras de linha são convertidas. Esse é
o modo de conversão padrão.
Apesar do nome deste modo ser ASCII, o qual é um padrão de 7 bit, o
modo é em verdade 8 bit. Sempre use este modo quando quiser
converter arquivos Unicode UTF-8.
7bit
Neste modo todos os caracteres não-ASCII de 8 bit (com valores entre
128 e 255) são convertidos para um espaço de 7 bit.
iso Caracteres são convertidos entre um conjunto de caracteres do DOS
(página de código) e conjunto de caracteres ISO-8859-1 (Latin-1) no
Unix. Caracteres de DOS sem um equivalente ISO-8859-1, para os quais
a conversão não é possível, são convertidos para um ponto. O mesmo
vale para caracteres ISO-8859-1 sem a contraparte DOS.
Quando apenas a opção "-iso" for usada, dos2unix vai tentar
determinar a página de código ativa. Quando isso não for possível,
dos2unix vai usar a página de código padrão CP437, a qual é usada
principalmente nos EUA. Para forçar uma página de código específica,
use as opções -437 (EUA), -850 (Europeu oriental), -860 (Português),
-863 (Franco-canadense) ou -865 (Nórdico). Também há suporte à
página de código do Windows CP1252 (Europeu ocidental) com a opção
-1252. Para outras páginas de código, use dos2unix em combinação cm
iconv(1). Iconv pode converter entre uma lista grande de
codificações de caracteres.
Nunca use conversão ISO em arquivos textos Unicode. Isso vai
corromper os arquivos codificados em UTF-8.
Alguns exemplos:
Conversão da página de código padrão do DOS para Latin-1 do Unix:
dos2unix -iso -n entrada.txt saída.txt
Conversão da CP850 do DOS para Latin-1 do Unix:
dos2unix -850 -n entrada.txt saída.txt
Conversão da CP1252 do Windows para Latin-1 do Unix:
dos2unix -1252 -n entrada.txt saída.txt
Conversão da CP1252 do Windows para UTF-8 (Unicode) do Unix:
iconv -f CP1252 -t UTF-8 entrada.txt | dos2unix > saída.txt
Conversão de Latin-1 do Unix para página de código padrão do DOS:
unix2dos -iso -n entrada.txt saída.txt
Conversão do Latin-1 do Unix para CP850 do DOS:
unix2dos -850 -n entrada.txt saída.txt
Conversão do Latin-1 do unix para CP1252 do Windows:
unix2dos -1252 -n entrada.txt saída.txt
Conversão do UTF-8 (Unicode) do Unix para CP1252 do Windows:
unix2dos < entrada.txt | iconv -f UTF-8 -t CP1252 > saída.txt
Veja também <http://czyborra.com/charsets/codepages.html> e
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Codificações
Exitem codificações Unicode diferentes. No Unix e no Linux, arquivos
Unicode são geralmente codificados em UTF-8. No Windows, arquivos texto
Unicode podem ser codificados em UTF-8, UTF-16 ou UTF-16 big endian, mas
na maioria das vezes são codificados no formato UTF-16.
Conversão
Arquivos texto em Unicode pode ter quebras de linha DOS, Unix ou Mac,
como arquivos texto comuns.
Todas as versões do dos2unix e unix2dos podem converter arquivos
codificados em UTF-8 porque UTF-8 foi projetado para ter compatibilidade
reversa com ASCII.
Dos2unix e unix2dos com suporte a Unicode UTF-16 podem ler arquivos
texto codificados em little e big endian UTF-16. Para ver se dos2unix
foi compilado com suporte a UTF-16, digite "dos2unix -V".
No Unix/Linux, arquivos codificados em UTF-16 são convertidos para a
codificação de caracteres do localização. Use o comando locale(1) para
descobrir qual é a codificação de caracteres da localização. Quando a
conversão não for possível, ocorrerá um erro e o arquivo será ignorado.
No Windows, arquivos UTF-16 são convertidos, por padrão, para UTF-8.
Arquivos texto formatados em UTF-8 possuem ótimo suporte em ambos
Windows e Unix/Linux.
Codificações UTF-16 e UTF-8 são completamente compatíveis, não havendo
qualquer perda de texto na conversão. Quando um erro de conversão UTF-16
para UTF-8 ocorre, por exemplo quando o arquivo de entrada UTF-16 contém
um erro, o arquivo será ignorado.
Quando a opção "-u" é usada, o arquivo de saída será escrito na mesma
codificação UTF-16 que o arquivo de saída. A opção "-u" evita conversão
para UTF-8.
Dos2unix e unix2dos não possuem opção para converter arquivos UTF-8 ára
UTF-16.
Modo de conversão ISO e 7-bit não funciona em arquivos UTF-16.
Marca de ordem de byte
No Windows, arquivos Unicode normalmente têm uma Marca de Ordem de Byte
(BOM), porque muitos programas (incluindo o Bloco de Notas) adiciona
BOMs por padrão. Veja também
<http://en.wikipedia.org/wiki/Byte_order_mark>.
No Unix, arquivos Unicode normalmente não têm BOM. Presume-se que
arquivos texto são codificados na codificação de caracteres da
localização.
Dos2unix pode detectar apenas se um arquivo está no formato UTF-16 se o
arquivo tiver BOM. Quando um arquivo UTF-16 não tiver BOM, dos2unix vai
ver se o arquivo é um arquivo binário.
Use a opção "-ul" ou "-ub" para converter um arquivo UTF-16 sem BOM.
Dos2unix escreve por padrão nenhum BOM no arquivo de saída. Com a opção
"-b", o Dos2unix escreve um BOM quando o arquivo de entrada possuir BOM.
Unix2dos escreve por padrão um BOM no arquivo de saída quando o arquivo
de entrada tem BOM. Use a opção "-m" para remover BOM.
Dos2unix e unix2dos sempre escrevem BOM quando a opção "-m" é usada.
Exemplos de Unicode
Conversão de UTF-16 do Windows (com BOM) para UTF-8 do Unix:
dos2unix -n entrada.txt saída.txt
Conversão de UTF-16LE do Windows (sem BOM) para UTF-8 do Unix:
dos2unix -ul -n entrada.txt saída.txt
Conversão de UTF-8 Unix para UTF-8 do Windows com BOM:
unix2dos -m -n entrada.txt saída.txt
Conversão de UTF-8 do Unix para UTF-16 do Windows:
unix2dos < entrada.txt | iconv -f UTF-8 -t UTF-16 > saída.txt
GB18030
GB18030 é um padrão governamental chinês. Um subconjunto obrigatório do
padrão GB18030 é exigido oficialmente para todos os produtos de software
vendidos na China. Veja também <http://en.wikipedia.org/wiki/GB_18030>.
GB18030 é completamente compatível com Unicode e pode ser considerado um
formato de transformação de unicode. Assim como UTF-8, GB18030 é
compatível com ASCII. GB18030 também é compatível com a página de código
936 do Windows, também conhecida como GBK.
No Unix/Linux, arquivos UTF-16 são convertidos para GB18030 quando a
codificação da localização é definida para GB18030. Note que isso vai
funcionar apenas se a localização estiver definida para China. Por
exemplo, em uma configuração de localização inglesa (Britânia) a
conversão "en_GB.GB18030" de UTF-16 para GB18030 não vai funcionar, mas
em uma configuração de localização "zh_CN.GB18030" chinesa vai
funcionar.
No Windows, você precisa usar a opção "-gb" para converter arquivos
UTF-16 para GB18030.
Arquivos codificados em GB18030 possuem uma marca de ordem de bytes,
como arquivos Unicode.
EXEMPLOS
Lê a entrada da "stdin" e escreve a saída para "stdout":
dos2unix
dos2unix -l -c mac
Converte e substitui a.txt. Converte e substitui b.txt:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Converte e substitui a.txt no modo de conversão ascii:
dos2unix a.txt
Converte e substitui a.txt no modo de conversão ascii. Converte e
substitui b.txt no modo de conversão 7bit:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Converte a.txt do formato do Mac para Unix:
dos2unix -c mac a.txt
mac2unix a.txt
Converte a.txt do formato do Unix para Mac:
unix2dos -c mac a.txt
unix2mac a.txt
Converte e substitui a.txt enquanto mantém a marca de data original:
dos2unix -k a.txt
dos2unix -k -o a.txt
Converte a.txt e escreve para e.txt:
dos2unix -n a.txt e.txt
Converte a.txt e escreve para e.txt, mantém a marca de data de e.txt
igual a a.txt:
dos2unix -k -n a.txt e.txt
Converte e substitui a.txt. Converte b.txt e escreve para e.txt:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Converte c.txt e escreve para e.txt. Converte e substitui a.txt.
Converte e substitui b.txt. Converte d.txt e escreve para f.txt:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
Conversão recursiva
Use dos2unix em combinação com os comandos find(1) e xargs(1) para
converter recursivamente arquivos texto em uma estrutura de árvore de
diretórios. Por exemplo, para converter todos os arquivos .txt na árvore
de diretórios sob o diretório atual, digite:
find . -name *.txt |xargs dos2unix
LOCALIZAÇÃO
LANG
O idioma primário é selecionado com a variável de ambiente LANG. A
variável LANG consiste em várias partes. A primeira parte está em
letras pequenas no código do idioma. A segunda parte é opcional e é
o código do país em letras maiúsculo, precedido de um ponto. Alguns
exemplos para shells do tipo padrão POSIX:
export LANG=nl Holandês
export LANG=nl_NL Holandês, Holanda
export LANG=nl_BE Holandês, Bélgica
export LANG=es_ES Espanhol, Espanha
export LANG=es_MX Espanhol, México
export LANG=en_US.iso88591 Inglês, EUA, codificação Latin-1
export LANG=en_GB.UTF-8 Inglês, Reino Unido, codificação UTF-8
Para a lista completa de códigos de idioma e país, veja o manual do
gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
Nos sistemas Unix, você pode usar o comando locale(1) para obter
informação específica da localização.
LANGUAGE
Com a variável de ambiente LANGUAGE, você pode especificar uma lista
de prioridades de idiomas, separada por vírgulas. Dos2unix fornece
preferência à LANGUAGE sobre LANG. Por exemplo, primeiro holandês e,
então, alemão: "LANGUAGE=nl:de". Você primeiro tem que habilitar
localização, definindo LANG (ou LC_ALL) para um valor diferente de
"C", antes que você possa usar uma lista de prioridade de idioma por
meio da variável LANGUAGE. Veja também o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Se você selecionou um idioma que não está disponível, você vai terá
as mensagens em inglês (padrão).
DOS2UNIX_LOCALEDIR
Com a variável de ambiente DOS2UNIX_LOCALEDIR, o LOCALEDIR definido
durante a compilação pode ser sobrescrito. LOCALEDIR é usada para
localizar os arquivos de idioma. O valor padrão do GNU é
"/usr/local/share/locale". A opção --version vai exibir o LOCALEDIR
que é usado.
Exemplo (shell POSIX):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
VALOR RETORNADO
No sucesso, zero é retornado. Quando um erro de sistema ocorre, o último
erro de sistema será retornado. Para outros erros, 1 é retornado.
O valor retornado é sempre zero no modo quieto, exceto quando opções de
linha de comando erradas são usadas.
PADRÕES
<http://en.wikipedia.org/wiki/Text_file>
<http://en.wikipedia.org/wiki/Carriage_return>
<http://en.wikipedia.org/wiki/Newline>
<http://en.wikipedia.org/wiki/Unicode>
AUTORES
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (modo
mac2unix) - <wuebben@kde.org>, Christian Wurll (adiciona nova linha
extra) - <wurll@ira.uka.de>, Erwin Waterlander - <waterlan@xs4all.nl>
(mantenedor)
Página do projeto: <http://waterlan.home.xs4all.nl/dos2unix.html>
Página do SourceForge: <http://sourceforge.net/projects/dos2unix/>
Veja também
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,654 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dos2unix 7.2 - програма для перетворення даних у текстовому форматі DOS/Mac у формат Unix, і навпаки</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<ul id="index">
<li><a href="#">&#x41D;&#x410;&#x417;&#x412;&#x410;</a></li>
<li><a href="#1">&#x41A;&#x41E;&#x420;&#x41E;&#x422;&#x41A;&#x418;&#x419; &#x41E;&#x41F;&#x418;&#x421;</a></li>
<li><a href="#2">&#x41E;&#x41F;&#x418;&#x421;</a></li>
<li><a href="#3">&#x41F;&#x410;&#x420;&#x410;&#x41C;&#x415;&#x422;&#x420;&#x418;</a></li>
<li><a href="#MAC">&#x420;&#x415;&#x416;&#x418;&#x41C; MAC</a></li>
<li><a href="#4">&#x420;&#x415;&#x416;&#x418;&#x41C;&#x418; &#x41F;&#x415;&#x420;&#x415;&#x422;&#x412;&#x41E;&#x420;&#x415;&#x41D;&#x41D;&#x42F;</a></li>
<li><a href="#UNICODE">UNICODE</a>
<ul>
<li><a href="#5">&#x41A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;</a></li>
<li><a href="#6">&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;</a></li>
<li><a href="#7">&#x41F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;</a></li>
<li><a href="#Unicode">&#x41F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;&#x438; &#x434;&#x43B;&#x44F; Unicode</a></li>
</ul>
</li>
<li><a href="#GB18030">GB18030</a></li>
<li><a href="#8">&#x41F;&#x420;&#x418;&#x41A;&#x41B;&#x410;&#x414;&#x418;</a></li>
<li><a href="#9">&#x420;&#x415;&#x41A;&#x423;&#x420;&#x421;&#x418;&#x412;&#x41D;&#x415; &#x41F;&#x415;&#x420;&#x415;&#x422;&#x412;&#x41E;&#x420;&#x415;&#x41D;&#x41D;&#x42F;</a></li>
<li><a href="#10">&#x41B;&#x41E;&#x41A;&#x410;&#x41B;&#x406;&#x417;&#x410;&#x426;&#x406;&#x42F;</a></li>
<li><a href="#11">&#x41F;&#x41E;&#x412;&#x415;&#x420;&#x41D;&#x423;&#x422;&#x415; &#x417;&#x41D;&#x410;&#x427;&#x415;&#x41D;&#x41D;&#x42F;</a></li>
<li><a href="#12">&#x421;&#x422;&#x410;&#x41D;&#x414;&#x410;&#x420;&#x422;&#x418;</a></li>
<li><a href="#13">&#x410;&#x412;&#x422;&#x41E;&#x420;&#x418;</a></li>
<li><a href="#14">&#x422;&#x410;&#x41A;&#x41E;&#x416; &#x41F;&#x415;&#x420;&#x415;&#x413;&#x41B;&#x42F;&#x41D;&#x42C;&#x422;&#x415;</a></li>
</ul>
<h1 id="">&#x41D;&#x410;&#x417;&#x412;&#x410;</h1>
<p>dos2unix - &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; DOS/Mac &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; Unix, &#x456; &#x43D;&#x430;&#x432;&#x43F;&#x430;&#x43A;&#x438;</p>
<h1 id="1">&#x41A;&#x41E;&#x420;&#x41E;&#x422;&#x41A;&#x418;&#x419; &#x41E;&#x41F;&#x418;&#x421;</h1>
<pre><code> dos2unix [&#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438;] [&#x424;&#x410;&#x419;&#x41B; ...] [-n &#x412;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; &#x412;&#x418;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; ...]
unix2dos [&#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438;] [&#x424;&#x410;&#x419;&#x41B; ...] [-n &#x412;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; &#x412;&#x418;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; ...]</code></pre>
<h1 id="2">&#x41E;&#x41F;&#x418;&#x421;</h1>
<p>&#x414;&#x43E; &#x441;&#x43A;&#x43B;&#x430;&#x434;&#x443; &#x43F;&#x430;&#x43A;&#x443;&#x43D;&#x43A;&#x430; Dos2unix &#x432;&#x43A;&#x43B;&#x44E;&#x447;&#x435;&#x43D;&#x43E; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x438; <code>dos2unix</code> &#x442;&#x430; <code>unix2dos</code>, &#x43F;&#x440;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x456; &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x437;&#x432;&#x438;&#x447;&#x430;&#x439;&#x43D;&#x438;&#x445; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; DOS &#x430;&#x431;&#x43E; Mac &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Unix, &#x456; &#x43D;&#x430;&#x432;&#x43F;&#x430;&#x43A;&#x438;.</p>
<p>&#x423; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; DOS/Windows &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; &#x430;&#x431;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x445;&#x456;&#x434; &#x43D;&#x430; &#x43D;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x44F;&#x434;&#x43E;&#x43A; &#x437;&#x434;&#x456;&#x439;&#x441;&#x43D;&#x44E;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x43A;&#x43E;&#x43C;&#x431;&#x456;&#x43D;&#x430;&#x446;&#x456;&#x457; &#x434;&#x432;&#x43E;&#x445; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432;: &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x435;&#x43D;&#x43D;&#x44F; &#x43A;&#x430;&#x440;&#x435;&#x442;&#x43A;&#x438; (CR) &#x456; &#x43F;&#x435;&#x440;&#x435;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43D;&#x44F; &#x440;&#x44F;&#x434;&#x43A;&#x430; (LF). &#x423; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; Unix &#x437;&#x430; &#x43F;&#x435;&#x440;&#x435;&#x445;&#x456;&#x434; &#x43D;&#x430; &#x43D;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x44F;&#x434;&#x43E;&#x43A; &#x432;&#x456;&#x434;&#x43F;&#x43E;&#x432;&#x456;&#x434;&#x430;&#x454; &#x43E;&#x434;&#x438;&#x43D; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;: &#x43F;&#x435;&#x440;&#x435;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43D;&#x44F; &#x440;&#x44F;&#x434;&#x43A;&#x430; (LF). &#x423; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; Mac, &#x434;&#x43E; Mac OS X, &#x437;&#x430; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; &#x432;&#x456;&#x434;&#x43F;&#x43E;&#x432;&#x456;&#x434;&#x430;&#x432; &#x43E;&#x434;&#x438;&#x43D; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;: &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x435;&#x43D;&#x43D;&#x44F; &#x43A;&#x430;&#x440;&#x435;&#x442;&#x43A;&#x438; (CR). &#x423; &#x441;&#x443;&#x447;&#x430;&#x441;&#x43D;&#x438;&#x445; &#x432;&#x435;&#x440;&#x441;&#x456;&#x44F;&#x445; Mac OS &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x439; &#x434;&#x43B;&#x44F; Unix &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; (LF).</p>
<p>&#x41E;&#x43A;&#x440;&#x456;&#x43C; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x430;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; Dos2unix &#x437;&#x434;&#x430;&#x442;&#x43D;&#x430; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;. &#x41C;&#x43E;&#x436;&#x43D;&#x430; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x434;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x43E;&#x445; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;&#x445; DOS &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix. &#x422;&#x430;&#x43A;&#x43E;&#x436; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; Windows Unicode (UTF-16) &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Unix Unicode (UTF-8).</p>
<p>&#x41F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43F;&#x440;&#x43E;&#x43F;&#x443;&#x441;&#x43A;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x434;&#x432;&#x456;&#x439;&#x43A;&#x43E;&#x432;&#x456; &#x444;&#x430;&#x439;&#x43B;&#x438;, &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x438; &#x43D;&#x435; &#x43D;&#x430;&#x43A;&#x430;&#x436;&#x435;&#x442;&#x435; &#x457;&#x439; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x442;&#x430;&#x43A;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x431;&#x435;&#x437;&#x43F;&#x43E;&#x441;&#x435;&#x440;&#x435;&#x434;&#x43D;&#x44C;&#x43E;.</p>
<p>&#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x430;&#x432;&#x442;&#x43E;&#x43C;&#x430;&#x442;&#x438;&#x447;&#x43D;&#x43E; &#x43F;&#x440;&#x43E;&#x43F;&#x443;&#x441;&#x43A;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x444;&#x430;&#x439;&#x43B;&#x438;, &#x44F;&#x43A;&#x456; &#x43D;&#x435; &#x454; &#x437;&#x432;&#x438;&#x447;&#x430;&#x439;&#x43D;&#x438;&#x43C;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x43C;&#x438;, &#x437;&#x43E;&#x43A;&#x440;&#x435;&#x43C;&#x430; &#x43A;&#x430;&#x442;&#x430;&#x43B;&#x43E;&#x433;&#x438; &#x442;&#x430; &#x43A;&#x430;&#x43D;&#x430;&#x43B;&#x438; FIFO.</p>
<p>&#x422;&#x438;&#x43F;&#x43E;&#x432;&#x43E;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43D;&#x435; &#x432;&#x43D;&#x43E;&#x441;&#x438;&#x442;&#x438;&#x43C;&#x435; &#x437;&#x43C;&#x456;&#x43D; &#x434;&#x43E; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x438;&#x445; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x44C; &#x442;&#x430; &#x43E;&#x431;&rsquo;&#x454;&#x43A;&#x442;&#x456;&#x432; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x44C;. &#x42F;&#x43A;&#x449;&#x43E; &#x43F;&#x43E;&#x442;&#x440;&#x456;&#x431;&#x43D;&#x43E;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43C;&#x43E;&#x436;&#x435; &#x437;&#x430;&#x43C;&#x456;&#x43D;&#x438;&#x442;&#x438; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x456; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F; &#x430;&#x431;&#x43E; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x456; &#x434;&#x430;&#x43D;&#x456; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430;-&#x43F;&#x440;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F;. &#x423; Windows &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443; &#x434;&#x43E; &#x43E;&#x431;&rsquo;&#x454;&#x43A;&#x442;&#x430; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F; &#x43D;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x434;&#x431;&#x430;&#x447;&#x435;&#x43D;&#x43E;.</p>
<p>&#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x443; dos2unix &#x431;&#x443;&#x43B;&#x43E; &#x441;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E; &#x437;&#x430; &#x437;&#x440;&#x430;&#x437;&#x43A;&#x43E;&#x43C; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x438; dos2unix &#x434;&#x43B;&#x44F; SunOS/Solaris. &#x412;&#x442;&#x456;&#x43C;, &#x456;&#x441;&#x43D;&#x443;&#x454; &#x43E;&#x434;&#x43D;&#x430; &#x432;&#x430;&#x436;&#x43B;&#x438;&#x432;&#x430; &#x432;&#x456;&#x434;&#x43C;&#x456;&#x43D;&#x43D;&#x456;&#x441;&#x442;&#x44C; &#x432;&#x456;&#x434; &#x43E;&#x440;&#x438;&#x433;&#x456;&#x43D;&#x430;&#x43B;&#x44C;&#x43D;&#x43E;&#x457; &#x432;&#x435;&#x440;&#x441;&#x456;&#x457; &#x434;&#x43B;&#x44F; SunOS/Solaris. &#x426;&#x44F; &#x432;&#x435;&#x440;&#x441;&#x456;&#x44F; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x454; &#x437;&#x430;&#x43C;&#x456;&#x43D;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x43F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; (&#x441;&#x442;&#x430;&#x440;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43E;&#x431;&#x440;&#x43E;&#x431;&#x43A;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;), &#x430; &#x443; &#x43E;&#x440;&#x438;&#x433;&#x456;&#x43D;&#x430;&#x43B;&#x44C;&#x43D;&#x456;&#x439; &#x432;&#x435;&#x440;&#x441;&#x456;&#x457; &#x434;&#x43B;&#x44F; SunOS/Solaris &#x43F;&#x435;&#x440;&#x435;&#x434;&#x431;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x43F;&#x456;&#x434;&#x442;&#x440;&#x438;&#x43C;&#x43A;&#x443; &#x43B;&#x438;&#x448;&#x435; &#x43F;&#x430;&#x440;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; (&#x43D;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43E;&#x431;&#x440;&#x43E;&#x431;&#x43A;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;). &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438; <code>-o</code> &#x442;&#x430; <code>-n</code>.</p>
<h1 id="3">&#x41F;&#x410;&#x420;&#x410;&#x41C;&#x415;&#x422;&#x420;&#x418;</h1>
<dl>
<dt id="pod"><b>--</b></dt>
<dd>
<p>&#x412;&#x432;&#x430;&#x436;&#x430;&#x442;&#x438; &#x443;&#x441;&#x456; &#x43D;&#x430;&#x441;&#x442;&#x443;&#x43F;&#x43D;&#x456; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438; &#x43D;&#x430;&#x437;&#x432;&#x430;&#x43C;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;. &#x426;&#x438;&#x43C; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; &#x441;&#x43B;&#x456;&#x434; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x442;&#x438;&#x441;&#x44F;, &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x430;&#x43C; &#x43F;&#x43E;&#x442;&#x440;&#x456;&#x431;&#x43D;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x447;&#x438;&#x457; &#x43D;&#x430;&#x437;&#x432;&#x438; &#x43C;&#x456;&#x441;&#x442;&#x44F;&#x442;&#x44C; &#x434;&#x435;&#x444;&#x456;&#x441;&#x438;. &#x41D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;, &#x449;&#x43E;&#x431; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x430; &laquo;-foo&raquo;, &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x442;&#x430;&#x43A;&#x43E;&#x44E; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43E;&#x44E;:</p>
<pre><code> dos2unix -- -foo</code></pre>
<p>&#x410;&#x431;&#x43E; &#x443; &#x43D;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;:</p>
<pre><code> dos2unix -n -- -foo out.txt</code></pre>
</dd>
<dt id="ascii"><b>-ascii</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43B;&#x438;&#x448;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432;. &#x422;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
</dd>
<dt id="iso"><b>-iso</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x437; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; DOS &#x43D;&#x430; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; ISO-8859-1. &#x414;&#x438;&#x432;. &#x440;&#x43E;&#x437;&#x434;&#x456;&#x43B; &#x449;&#x43E;&#x434;&#x43E; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456;&#x432; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
</dd>
<dt id="pod-1252"><b>-1252</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x442;&#x438; &#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x443; &#x442;&#x430;&#x431;&#x43B;&#x438;&#x446;&#x44E; 1252 Windows (&#x437;&#x430;&#x445;&#x456;&#x434;&#x43D;&#x43E;&#x454;&#x432;&#x440;&#x43E;&#x43F;&#x435;&#x439;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;).</p>
</dd>
<dt id="pod-437"><b>-437</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x443; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x443; DOS 437 (&#x421;&#x428;&#x410;). &#x426;&#x435; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x430; &#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x430; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x430; &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; ISO.</p>
</dd>
<dt id="pod-850"><b>-850</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x443; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x443; DOS 850 (&#x437;&#x430;&#x445;&#x456;&#x434;&#x43D;&#x43E;&#x454;&#x432;&#x440;&#x43E;&#x43F;&#x435;&#x439;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;).</p>
</dd>
<dt id="pod-860"><b>-860</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x443; DOS 860 (&#x43F;&#x43E;&#x440;&#x442;&#x443;&#x433;&#x430;&#x43B;&#x44C;&#x441;&#x44C;&#x43A;&#x430;).</p>
</dd>
<dt id="pod-863"><b>-863</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x443; DOS 863 (&#x43A;&#x430;&#x43D;&#x430;&#x434;&#x441;&#x44C;&#x43A;&#x430; &#x444;&#x440;&#x430;&#x43D;&#x446;&#x443;&#x437;&#x44C;&#x43A;&#x430;).</p>
</dd>
<dt id="pod-865"><b>-865</b></dt>
<dd>
<p>&#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x443; DOS 865 (&#x441;&#x43A;&#x430;&#x43D;&#x434;&#x438;&#x43D;&#x430;&#x432;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;).</p>
</dd>
<dt id="pod-7"><b>-7</b></dt>
<dd>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x432;&#x430;&#x442;&#x438; 8-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x456; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438; &#x43D;&#x430; 7-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x456;.</p>
</dd>
<dt id="b---keep-bom"><b>-b, --keep-bom</b></dt>
<dd>
<p>&#x417;&#x431;&#x435;&#x440;&#x435;&#x433;&#x442;&#x438; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM). &#x42F;&#x43A;&#x449;&#x43E; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x438;&#x445; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x454; BOM, &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; BOM &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432;. &#x426;&#x435; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x430; &#x43F;&#x43E;&#x432;&#x435;&#x434;&#x456;&#x43D;&#x43A;&#x430; &#x43F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; &#x456;&#x437; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x430;&#x43C;&#x438; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-r</code>.</p>
</dd>
<dt id="c---convmode"><b>-c, --convmode &#x420;&#x415;&#x416;&#x418;&#x41C;</b></dt>
<dd>
<p>&#x412;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x438;&#x442;&#x438; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;. &#x417;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F;&#x43C; &#x430;&#x440;&#x433;&#x443;&#x43C;&#x435;&#x43D;&#x442;&#x443; &#x420;&#x415;&#x416;&#x418;&#x41C; &#x43C;&#x43E;&#x436;&#x435; &#x431;&#x443;&#x442;&#x438; &#x43E;&#x434;&#x438;&#x43D; &#x437; &#x442;&#x430;&#x43A;&#x438;&#x445; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432;: <i>ascii</i>, <i>7bit</i>, <i>iso</i>, <i>mac</i>. &#x422;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x43C; &#x454; &#x440;&#x435;&#x436;&#x438;&#x43C; ascii.</p>
</dd>
<dt id="f---force"><b>-f, --force</b></dt>
<dd>
<p>&#x41F;&#x440;&#x438;&#x43C;&#x443;&#x441;&#x43E;&#x432;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x434;&#x432;&#x456;&#x439;&#x43A;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;.</p>
</dd>
<dt id="gb---gb18030"><b>-gb, --gb18030</b></dt>
<dd>
<p>&#x423; Windows &#x444;&#x430;&#x439;&#x43B;&#x438; &#x432; UTF-16 &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x44E;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x432; UTF-8, &#x43D;&#x435;&#x437;&#x430;&#x43B;&#x435;&#x436;&#x43D;&#x43E; &#x432;&#x456;&#x434; &#x432;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x43E;&#x457; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456;. &#x417;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x446;&#x44C;&#x43E;&#x433;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; &#x432;&#x438; &#x43C;&#x43E;&#x436;&#x435;&#x442;&#x435; &#x43D;&#x430;&#x43A;&#x430;&#x437;&#x430;&#x442;&#x438; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x432;&#x430;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x432; UTF-16 &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; GB18030. &#x426;&#x438;&#x43C; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x442;&#x438;&#x441;&#x44F; &#x43B;&#x438;&#x448;&#x435; &#x443; Windows. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x440;&#x43E;&#x437;&#x434;&#x456;&#x43B;, &#x43F;&#x440;&#x438;&#x441;&#x432;&#x44F;&#x447;&#x435;&#x43D;&#x438;&#x439; GB18030.</p>
</dd>
<dt id="h---help"><b>-h, --help</b></dt>
<dd>
<p>&#x41F;&#x43E;&#x43A;&#x430;&#x437;&#x430;&#x442;&#x438; &#x434;&#x43E;&#x432;&#x456;&#x434;&#x43A;&#x43E;&#x432;&#x456; &#x434;&#x430;&#x43D;&#x456; &#x456; &#x437;&#x430;&#x432;&#x435;&#x440;&#x448;&#x438;&#x442;&#x438; &#x440;&#x43E;&#x431;&#x43E;&#x442;&#x443;.</p>
</dd>
<dt id="i---info"><b>-i[&#x41F;&#x420;&#x410;&#x41F;&#x41E;&#x420;&#x426;&#x406;], --info[=&#x41F;&#x420;&#x410;&#x41F;&#x41E;&#x420;&#x426;&#x406;] &#x424;&#x410;&#x419;&#x41B; ...</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x449;&#x43E;&#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430;. &#x41D;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
<p>&#x411;&#x443;&#x434;&#x435; &#x432;&#x438;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43E; &#x442;&#x430;&#x43A;&#x456; &#x434;&#x430;&#x43D;&#x456;, &#x443; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43E;&#x43C;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443;: &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; DOS, &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Unix, &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Mac, &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;, &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x43C; &#x447;&#x438; &#x431;&#x456;&#x43D;&#x430;&#x440;&#x43D;&#x438;&#x43C; &#x454; &#x444;&#x430;&#x439;&#x43B; &#x442;&#x430; &#x43D;&#x430;&#x437;&#x432;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x430;.</p>
<p>&#x41F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432;:</p>
<pre><code> 6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe</code></pre>
<p>&#x41A;&#x440;&#x456;&#x43C; &#x442;&#x43E;&#x433;&#x43E;, &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x442;&#x438; &#x434;&#x43E;&#x434;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x456; &#x43F;&#x440;&#x430;&#x43F;&#x43E;&#x440;&#x446;&#x456; &#x434;&#x43B;&#x44F; &#x432;&#x43D;&#x435;&#x441;&#x435;&#x43D;&#x43D;&#x44F; &#x437;&#x43C;&#x456;&#x43D; &#x443; &#x432;&#x438;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x456; &#x434;&#x430;&#x43D;&#x456;. &#x41C;&#x43E;&#x436;&#x43D;&#x430; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43E;&#x434;&#x438;&#x43D; &#x430;&#x431;&#x43E; &#x434;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x430; &#x442;&#x430;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x430;&#x43F;&#x43E;&#x440;&#x446;&#x456;&#x432;.</p>
<dl>
<dt id="d"><b>d</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; DOS.</p>
</dd>
<dt id="u"><b>u</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; Unix.</p>
</dd>
<dt id="m"><b>m</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x430; Mac.</p>
</dd>
<dt id="b"><b>b</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;.</p>
</dd>
<dt id="t"><b>t</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x449;&#x43E;&#x434;&#x43E; &#x442;&#x43E;&#x433;&#x43E;, &#x454; &#x444;&#x430;&#x439;&#x43B; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x43C; &#x447;&#x438; &#x431;&#x456;&#x43D;&#x430;&#x440;&#x43D;&#x438;&#x43C;.</p>
</dd>
<dt id="c"><b>c</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x43B;&#x438;&#x448;&#x435; &#x442;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x44F;&#x43A;&#x456; &#x431;&#x443;&#x43B;&#x43E; &#x431; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E;.</p>
<p>&#x406;&#x437; &#x43F;&#x440;&#x430;&#x43F;&#x43E;&#x440;&#x446;&#x435;&#x43C; <code>c</code> dos2unix &#x432;&#x438;&#x432;&#x435;&#x434;&#x435; &#x43B;&#x438;&#x448;&#x435; &#x43D;&#x430;&#x437;&#x432;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x443; &#x44F;&#x43A;&#x438;&#x445; &#x43C;&#x456;&#x441;&#x442;&#x44F;&#x442;&#x44C;&#x441;&#x44F; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS. unix2dos &#x432;&#x438;&#x432;&#x435;&#x434;&#x435; &#x43B;&#x438;&#x448;&#x435; &#x43D;&#x430;&#x437;&#x432;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x443; &#x44F;&#x43A;&#x438;&#x445; &#x43C;&#x456;&#x441;&#x442;&#x44F;&#x442;&#x44C;&#x441;&#x44F; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix.</p>
</dd>
</dl>
<p>&#x41F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;&#x438;:</p>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x449;&#x43E;&#x434;&#x43E; &#x443;&#x441;&#x456;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; *.txt:</p>
<pre><code> dos2unix -i *.txt</code></pre>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x456;&#x441;&#x442;&#x44C; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; DOS &#x456; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x456;&#x432; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Unix:</p>
<pre><code> dos2unix -idu *.txt</code></pre>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x43B;&#x438;&#x448;&#x435; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;:</p>
<pre><code> dos2unix --info=b *.txt</code></pre>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x443; &#x44F;&#x43A;&#x438;&#x445; &#x454; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS:</p>
<pre><code> dos2unix -ic *.txt</code></pre>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;, &#x443; &#x44F;&#x43A;&#x438;&#x445; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix:</p>
<pre><code> unix2dos -ic *.txt</code></pre>
</dd>
<dt id="k---keepdate"><b>-k, --keepdate</b></dt>
<dd>
<p>&#x417;&#x431;&#x435;&#x440;&#x435;&#x433;&#x442;&#x438; &#x447;&#x430;&#x441;&#x43E;&#x432;&#x443; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x438;&#x445; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
</dd>
<dt id="L---license"><b>-L, --license</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x443;&#x43C;&#x43E;&#x432;&#x438; &#x43B;&#x456;&#x446;&#x435;&#x43D;&#x437;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x438;.</p>
</dd>
<dt id="l---newline"><b>-l, --newline</b></dt>
<dd>
<p>&#x412;&#x441;&#x442;&#x430;&#x432;&#x438;&#x442;&#x438; &#x434;&#x43E;&#x434;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x439; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x430;.</p>
<p><b>dos2unix</b>: &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x430; &#x434;&#x432;&#x430; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix &#x432;&#x456;&#x434;&#x431;&#x443;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x43B;&#x438;&#x448;&#x435; &#x434;&#x43B;&#x44F; &#x43A;&#x43E;&#x43C;&#x431;&#x456;&#x43D;&#x430;&#x446;&#x456;&#x439; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS. &#x423; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; Mac &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x430; &#x434;&#x432;&#x430; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix &#x43B;&#x438;&#x448;&#x435; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Mac.</p>
<p><b>unix2dos</b>: &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x430; &#x434;&#x432;&#x456; &#x43A;&#x43E;&#x43C;&#x431;&#x456;&#x43D;&#x430;&#x446;&#x456;&#x457; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS &#x432;&#x456;&#x434;&#x431;&#x443;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x43B;&#x438;&#x448;&#x435; &#x434;&#x43B;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS. &#x423; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; Mac &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x430; &#x434;&#x432;&#x430; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Mac &#x43B;&#x438;&#x448;&#x435; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix.</p>
</dd>
<dt id="m---add-bom"><b>-m, --add-bom</b></dt>
<dd>
<p>&#x417;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM). &#x422;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x431;&#x443;&#x434;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x43D;&#x43E; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; UTF-8.</p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x434;&#x430;&#x43D;&#x456; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x437;&#x430;&#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x430;&#x43D;&#x43E; &#x443; UTF-16 &#x456; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-u</code>, &#x431;&#x443;&#x434;&#x435; &#x434;&#x43E;&#x43F;&#x438;&#x441;&#x430;&#x43D;&#x43E; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; UTF-16.</p>
<p>&#x41D;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x439;&#x442;&#x435; &#x446;&#x435;&#x439; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; &#x434;&#x43B;&#x44F; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x44C; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432;, &#x432;&#x456;&#x434;&#x43C;&#x456;&#x43D;&#x43D;&#x438;&#x445; &#x432;&#x456;&#x434; UTF-8 &#x430;&#x431;&#x43E; UTF-16. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x440;&#x43E;&#x437;&#x434;&#x456;&#x43B; &#x449;&#x43E;&#x434;&#x43E; UNICODE.</p>
</dd>
<dt id="n---newfile-_-_"><b>-n, --newfile &#x412;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; &#x412;&#x418;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; ...</b></dt>
<dd>
<p>&#x41D;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43E;&#x431;&#x440;&#x43E;&#x431;&#x43A;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432;. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x437; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x412;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B; &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x412;&#x418;&#x425;&#x406;&#x414;&#x41D;&#x418;&#x419;_&#x424;&#x410;&#x419;&#x41B;. &#x41D;&#x430;&#x437;&#x432;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x441;&#x43B;&#x456;&#x434; &#x432;&#x43A;&#x430;&#x437;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x438;, <i>&#x43D;&#x435; &#x441;&#x43B;&#x456;&#x434;</i> &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x448;&#x430;&#x431;&#x43B;&#x43E;&#x43D;&#x438; &#x437;&#x430;&#x43C;&#x456;&#x43D;&#x438;, &#x456;&#x43D;&#x430;&#x43A;&#x448;&#x435; &#x432;&#x43C;&#x456;&#x441;&#x442; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; <i>&#x431;&#x443;&#x434;&#x435; &#x432;&#x442;&#x440;&#x430;&#x447;&#x435;&#x43D;&#x43E;</i>.</p>
<p>&#x412;&#x43B;&#x430;&#x441;&#x43D;&#x438;&#x43A;&#x43E;&#x43C; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x431;&#x443;&#x434;&#x435; &#x43F;&#x440;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x447;&#x430;, &#x44F;&#x43A;&#x438;&#x43C; &#x431;&#x443;&#x43B;&#x43E; &#x440;&#x43E;&#x437;&#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x43D;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; (&#x43F;&#x430;&#x440;&#x43D;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456;). &#x41F;&#x440;&#x430;&#x432;&#x430; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443; &#x43D;&#x430; &#x447;&#x438;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x430;&#x431;&#x43E; &#x437;&#x430;&#x43F;&#x438;&#x441; &#x43D;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x431;&#x443;&#x434;&#x435; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x43D;&#x430; &#x43E;&#x441;&#x43D;&#x43E;&#x432;&#x456; &#x43F;&#x440;&#x430;&#x432; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443; &#x434;&#x43E; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x43C;&#x456;&#x43D;&#x443;&#x441; umask(1) &#x434;&#x43B;&#x44F; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x447;&#x430;, &#x44F;&#x43A;&#x438;&#x43C; &#x431;&#x443;&#x43B;&#x43E; &#x440;&#x43E;&#x437;&#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
</dd>
<dt id="o---oldfile"><b>-o, --oldfile &#x424;&#x410;&#x419;&#x41B; ...</b></dt>
<dd>
<p>&#x417;&#x430;&#x441;&#x442;&#x430;&#x440;&#x456;&#x43B;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43E;&#x431;&#x440;&#x43E;&#x431;&#x43A;&#x438;. &#x412;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x424;&#x410;&#x419;&#x41B; &#x456; &#x43F;&#x435;&#x440;&#x435;&#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x439;&#x43E;&#x433;&#x43E; &#x432;&#x43C;&#x456;&#x441;&#x442;. &#x422;&#x438;&#x43F;&#x43E;&#x432;&#x43E;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x454; &#x443; &#x446;&#x44C;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456;. &#x41C;&#x43E;&#x436;&#x43D;&#x430; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x448;&#x430;&#x431;&#x43B;&#x43E;&#x43D;&#x438; &#x437;&#x430;&#x43C;&#x456;&#x43D;&#x438;.</p>
<p>&#x423; &#x437;&#x430;&#x441;&#x442;&#x430;&#x440;&#x456;&#x43B;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; (&#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x437;&#x430;&#x43C;&#x456;&#x449;&#x435;&#x43D;&#x43D;&#x44F;) &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B; &#x43D;&#x430;&#x43B;&#x435;&#x436;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x442;&#x43E;&#x43C;&#x443; &#x441;&#x430;&#x43C;&#x43E;&#x43C;&#x443; &#x432;&#x43B;&#x430;&#x441;&#x43D;&#x438;&#x43A;&#x443; &#x456; &#x433;&#x440;&#x443;&#x43F;&#x456; &#x456; &#x43C;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x442;&#x456; &#x441;&#x430;&#x43C;&#x456; &#x43F;&#x440;&#x430;&#x432;&#x430; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443; &#x43D;&#x430; &#x447;&#x438;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x430;&#x431;&#x43E; &#x437;&#x430;&#x43F;&#x438;&#x441;, &#x449;&#x43E; &#x456; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x41A;&#x440;&#x456;&#x43C; &#x442;&#x43E;&#x433;&#x43E;, &#x44F;&#x43A;&#x449;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x456;&#x43D;&#x448;&#x438;&#x43C; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x447;&#x435;&#x43C;, &#x44F;&#x43A;&#x438;&#x439; &#x43C;&#x430;&#x454; &#x43F;&#x440;&#x430;&#x432;&#x430; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443; &#x43D;&#x430; &#x437;&#x430;&#x43F;&#x438;&#x441; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; (&#x43D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x447;&#x435;&#x43C; root), &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x431;&#x443;&#x434;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x440;&#x432;&#x430;&#x43D;&#x43E;, &#x44F;&#x43A;&#x449;&#x43E; &#x437;&#x431;&#x435;&#x440;&#x435;&#x433;&#x442;&#x438; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x456; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x435; &#x432;&#x434;&#x430;&#x441;&#x442;&#x44C;&#x441;&#x44F;. &#x417;&#x43C;&#x456;&#x43D;&#x430; &#x432;&#x43B;&#x430;&#x441;&#x43D;&#x438;&#x43A;&#x430; &#x43C;&#x43E;&#x436;&#x435; &#x43E;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x442;&#x438; &#x43D;&#x435;&#x43C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x456;&#x441;&#x442;&#x44C; &#x447;&#x438;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x434;&#x43B;&#x44F; &#x439;&#x43E;&#x433;&#x43E; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x432;&#x43B;&#x430;&#x441;&#x43D;&#x438;&#x43A;&#x430;. &#x417;&#x43C;&#x456;&#x43D;&#x430; &#x433;&#x440;&#x443;&#x43F;&#x438; &#x43C;&#x43E;&#x436;&#x435; &#x43F;&#x440;&#x438;&#x437;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x43E; &#x43F;&#x440;&#x43E;&#x431;&#x43B;&#x435;&#x43C; &#x456;&#x437; &#x431;&#x435;&#x437;&#x43F;&#x435;&#x43A;&#x43E;&#x44E;, &#x43E;&#x441;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x438; &#x444;&#x430;&#x439;&#x43B; &#x43C;&#x43E;&#x436;&#x435; &#x441;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x43D;&#x438;&#x43C; &#x434;&#x43B;&#x44F; &#x447;&#x438;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x432;&#x430;&#x447;&#x430;&#x43C;, &#x44F;&#x43A;&#x456; &#x43D;&#x435; &#x43F;&#x43E;&#x432;&#x438;&#x43D;&#x43D;&#x456; &#x43C;&#x430;&#x442;&#x438; &#x442;&#x430;&#x43A;&#x456; &#x43F;&#x440;&#x430;&#x432;&#x430; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443;. &#x41C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x456;&#x441;&#x442;&#x44C; &#x437;&#x431;&#x435;&#x440;&#x435;&#x436;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x440;&#x430;&#x432; &#x432;&#x43B;&#x430;&#x441;&#x43D;&#x43E;&#x441;&#x442;&#x456; &#x442;&#x430; &#x43F;&#x440;&#x430;&#x432; &#x434;&#x43E;&#x441;&#x442;&#x443;&#x43F;&#x443; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x43F;&#x435;&#x440;&#x435;&#x434;&#x431;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x43B;&#x438;&#x448;&#x435; &#x443; Unix.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>&#x420;&#x435;&#x436;&#x438;&#x43C; &#x431;&#x435;&#x437; &#x432;&#x438;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x44C;. &#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43D;&#x435; &#x432;&#x438;&#x432;&#x43E;&#x434;&#x438;&#x442;&#x438;&#x43C;&#x435; &#x436;&#x43E;&#x434;&#x43D;&#x438;&#x445; &#x43F;&#x43E;&#x43F;&#x435;&#x440;&#x435;&#x434;&#x436;&#x435;&#x43D;&#x44C; &#x430;&#x431;&#x43E; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x44C; &#x43F;&#x440;&#x43E; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x438;. &#x41F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x443;&#x442;&#x438;&#x43C; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F;&#x43C; &#x437;&#x430;&#x432;&#x436;&#x434;&#x438; &#x431;&#x443;&#x434;&#x435; &#x43D;&#x443;&#x43B;&#x44C;, &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43E; &#x43F;&#x440;&#x430;&#x432;&#x438;&#x43B;&#x44C;&#x43D;&#x456; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43D;&#x43E;&#x433;&#x43E; &#x440;&#x44F;&#x434;&#x43A;&#x430;.</p>
</dd>
<dt id="r---remove-bom"><b>-r, --remove-bom</b></dt>
<dd>
<p>&#x412;&#x438;&#x43B;&#x443;&#x447;&#x438;&#x442;&#x438; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM). &#x41D;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x432;&#x430;&#x442;&#x438; BOM &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432;. &#x426;&#x435; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x430; &#x43F;&#x43E;&#x432;&#x435;&#x434;&#x456;&#x43D;&#x43A;&#x430; &#x43F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x437; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x43E;&#x43C; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-b</code>.</p>
</dd>
<dt id="s---safe"><b>-s, --safe</b></dt>
<dd>
<p>&#x41F;&#x440;&#x43E;&#x43F;&#x443;&#x441;&#x43A;&#x430;&#x442;&#x438; &#x434;&#x432;&#x456;&#x439;&#x43A;&#x43E;&#x432;&#x456; &#x444;&#x430;&#x439;&#x43B;&#x438; (&#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E;).</p>
</dd>
<dt id="u---keep-utf16"><b>-u, --keep-utf16</b></dt>
<dd>
<p>&#x417;&#x431;&#x435;&#x440;&#x435;&#x433;&#x442;&#x438; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x435; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-16. &#x424;&#x430;&#x439;&#x43B; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x431;&#x443;&#x434;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x43D;&#x43E; &#x443; &#x442;&#x43E;&#x43C;&#x443; &#x441;&#x430;&#x43C;&#x43E;&#x43C;&#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16, &#x456;&#x437; &#x43F;&#x440;&#x44F;&#x43C;&#x438;&#x43C; &#x430;&#x431;&#x43E; &#x437;&#x432;&#x43E;&#x440;&#x43E;&#x442;&#x43D;&#x438;&#x43C; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x43E;&#x43C; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;, &#x449;&#x43E; &#x456; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x422;&#x430;&#x43A;&#x438;&#x43C; &#x447;&#x438;&#x43D;&#x43E;&#x43C; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x430;&#x43F;&#x43E;&#x431;&#x456;&#x433;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44E; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-8. &#x414;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x431;&#x443;&#x434;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x43D;&#x43E; &#x432;&#x456;&#x434;&#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43D;&#x443; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; UTF-16. &#x412;&#x438;&#x43C;&#x43A;&#x43D;&#x443;&#x442;&#x438; &#x446;&#x435;&#x439; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; <code>-ascii</code>.</p>
</dd>
<dt id="ul---assume-utf16le"><b>-ul, --assume-utf16le</b></dt>
<dd>
<p>&#x41F;&#x440;&#x438;&#x43F;&#x443;&#x441;&#x43A;&#x430;&#x442;&#x438;, &#x449;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x454; UTF-16LE.</p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x443; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; &#x454; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM), &#x457;&#x457; &#x431;&#x443;&#x434;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;-&#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;, &#x43D;&#x435;&#x437;&#x430;&#x43B;&#x435;&#x436;&#x43D;&#x43E; &#x432;&#x456;&#x434; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x446;&#x44C;&#x43E;&#x433;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430;.</p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x432;&#x430;&#x43C;&#x438; &#x431;&#x443;&#x43B;&#x43E; &#x437;&#x440;&#x43E;&#x431;&#x43B;&#x435;&#x43D;&#x43E; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x43E;&#x432;&#x435; &#x43F;&#x440;&#x438;&#x43F;&#x443;&#x449;&#x435;&#x43D;&#x43D;&#x44F; &#x449;&#x43E;&#x434;&#x43E; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x430; (&#x444;&#x430;&#x439;&#x43B; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x438;&#x445; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x43D;&#x430;&#x441;&#x43F;&#x440;&#x430;&#x432;&#x434;&#x456; &#x43D;&#x435; &#x454; &#x444;&#x430;&#x439;&#x43B;&#x43E;&#x43C; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; UTF-16LE), &#x456; &#x434;&#x430;&#x43D;&#x456; &#x432;&#x434;&#x430;&#x441;&#x442;&#x44C;&#x441;&#x44F; &#x443;&#x441;&#x43F;&#x456;&#x448;&#x43D;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438;, &#x432;&#x438; &#x43E;&#x442;&#x440;&#x438;&#x43C;&#x430;&#x454;&#x442;&#x435; &#x444;&#x430;&#x439;&#x43B; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 &#x437; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x43E;&#x432;&#x438;&#x43C; &#x432;&#x43C;&#x456;&#x441;&#x442;&#x43E;&#x43C;. &#x421;&#x43A;&#x430;&#x441;&#x443;&#x432;&#x430;&#x442;&#x438; &#x442;&#x430;&#x43A;&#x435; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x43E;&#x432;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x437;&#x432;&#x43E;&#x440;&#x43E;&#x442;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; iconv(1) &#x437; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; UTF-8 &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; UTF-16LE. &#x422;&#x430;&#x43A;&#x438;&#x43C; &#x447;&#x438;&#x43D;&#x43E;&#x43C; &#x432;&#x438; &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x435;&#x442;&#x435;&#x441;&#x44F; &#x434;&#x43E; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;.</p>
<p>&#x41F;&#x440;&#x438;&#x43F;&#x443;&#x449;&#x435;&#x43D;&#x43D;&#x44F; &#x449;&#x43E;&#x434;&#x43E; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-16LE &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x454; &#x44F;&#x43A; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; <i>&#x440;&#x435;&#x436;&#x438;&#x43C;&#x443; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;</i>. &#x41F;&#x435;&#x440;&#x435;&#x43C;&#x438;&#x43A;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x43D;&#x430; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; <i>ascii</i> &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x432;&#x438;&#x43C;&#x43A;&#x43D;&#x443;&#x442;&#x438; &#x43F;&#x440;&#x438;&#x43F;&#x443;&#x449;&#x435;&#x43D;&#x43D;&#x44F; &#x449;&#x43E;&#x434;&#x43E; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-16LE.</p>
</dd>
<dt id="ub---assume-utf16be"><b>-ub, --assume-utf16be</b></dt>
<dd>
<p>&#x41F;&#x440;&#x438;&#x43F;&#x443;&#x441;&#x43A;&#x430;&#x442;&#x438;, &#x449;&#x43E; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x438;&#x43C; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x43E;&#x43C; &#x454; UTF-16BE.</p>
<p>&#x426;&#x435;&#x439; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x454; &#x443; &#x441;&#x43F;&#x43E;&#x441;&#x456;&#x431;, &#x442;&#x43E;&#x442;&#x43E;&#x436;&#x43D;&#x438;&#x439; &#x434;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; <code>-ul</code>.</p>
</dd>
<dt id="v---verbose"><b>-v, --verbose</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x43E;&#x434;&#x438;&#x442;&#x438; &#x434;&#x43E;&#x43A;&#x43B;&#x430;&#x434;&#x43D;&#x456; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x43D;&#x44F;. &#x411;&#x443;&#x434;&#x435; &#x43F;&#x43E;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43E; &#x434;&#x43E;&#x434;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x456; &#x434;&#x430;&#x43D;&#x456; &#x449;&#x43E;&#x434;&#x43E; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43E;&#x43A; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; &#x442;&#x430; &#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x43E;&#x441;&#x442;&#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x438;&#x445; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432;.</p>
</dd>
<dt id="F---follow-symlink"><b>-F, --follow-symlink</b></dt>
<dd>
<p>&#x41F;&#x435;&#x440;&#x435;&#x445;&#x43E;&#x434;&#x438;&#x442;&#x438; &#x437;&#x430; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x438;&#x43C;&#x438; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x432;&#x430;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x438;, &#x43D;&#x430; &#x44F;&#x43A;&#x456; &#x432;&#x43E;&#x43D;&#x438; &#x432;&#x43A;&#x430;&#x437;&#x443;&#x44E;&#x442;&#x44C;.</p>
</dd>
<dt id="R---replace-symlink"><b>-R, --replace-symlink</b></dt>
<dd>
<p>&#x417;&#x430;&#x43C;&#x456;&#x43D;&#x438;&#x442;&#x438; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x456; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x438;&#x43C;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x43C;&#x438; (&#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x456; &#x444;&#x430;&#x439;&#x43B;&#x438;, &#x43D;&#x430; &#x44F;&#x43A;&#x456; &#x432;&#x43E;&#x43D;&#x438; &#x432;&#x43A;&#x430;&#x437;&#x443;&#x44E;&#x442;&#x44C;, &#x437;&#x43C;&#x456;&#x43D;&#x435;&#x43D;&#x43E; &#x43D;&#x435; &#x431;&#x443;&#x434;&#x435;).</p>
</dd>
<dt id="S---skip-symlink"><b>-S, --skip-symlink</b></dt>
<dd>
<p>&#x41D;&#x435; &#x437;&#x43C;&#x456;&#x43D;&#x44E;&#x432;&#x430;&#x442;&#x438; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x447;&#x43D;&#x456; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x43D;&#x43D;&#x44F; &#x442;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438;, &#x43D;&#x430; &#x44F;&#x43A;&#x456; &#x432;&#x43E;&#x43D;&#x438; &#x43F;&#x43E;&#x441;&#x438;&#x43B;&#x430;&#x44E;&#x442;&#x44C;&#x441;&#x44F; (&#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E;).</p>
</dd>
<dt id="V---version"><b>-V, --version</b></dt>
<dd>
<p>&#x412;&#x438;&#x432;&#x435;&#x441;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x449;&#x43E;&#x434;&#x43E; &#x432;&#x435;&#x440;&#x441;&#x456;&#x457; &#x456; &#x437;&#x430;&#x432;&#x435;&#x440;&#x448;&#x438;&#x442;&#x438; &#x440;&#x43E;&#x431;&#x43E;&#x442;&#x443;.</p>
</dd>
</dl>
<h1 id="MAC">&#x420;&#x415;&#x416;&#x418;&#x41C; MAC</h1>
<p>&#x423; &#x437;&#x432;&#x438;&#x447;&#x430;&#x439;&#x43D;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x44E;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x430; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix, &#x456; &#x43D;&#x430;&#x432;&#x43F;&#x430;&#x43A;&#x438;. &#x420;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Mac &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44E; &#x43D;&#x435; &#x43F;&#x456;&#x434;&#x43B;&#x44F;&#x433;&#x430;&#x44E;&#x442;&#x44C;.</p>
<p>&#x423; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; Mac &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Mac &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x44E;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x430; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; Unix, &#x456; &#x43D;&#x430;&#x432;&#x43F;&#x430;&#x43A;&#x438;. &#x420;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44E; &#x43D;&#x435; &#x43F;&#x456;&#x434;&#x43B;&#x44F;&#x433;&#x430;&#x44E;&#x442;&#x44C;.</p>
<p>&#x429;&#x43E;&#x431; &#x437;&#x430;&#x43F;&#x443;&#x441;&#x442;&#x438;&#x442;&#x438; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x443; &#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; Mac, &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43D;&#x43E;&#x433;&#x43E; &#x440;&#x44F;&#x434;&#x43A;&#x430; <code>-c mac</code> &#x430;&#x431;&#x43E; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430;&#x43C;&#x438; <code>mac2unix</code> &#x442;&#x430; <code>unix2mac</code>.</p>
<h1 id="4">&#x420;&#x415;&#x416;&#x418;&#x41C;&#x418; &#x41F;&#x415;&#x420;&#x415;&#x422;&#x412;&#x41E;&#x420;&#x415;&#x41D;&#x41D;&#x42F;</h1>
<dl>
<dt id="ascii1"><b>ascii</b></dt>
<dd>
<p>&#x423; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; <code>ascii</code> &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x43B;&#x438;&#x448;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x443; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432;. &#x426;&#x435;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x454; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x43C; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x43E;&#x43C; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;.</p>
<p>&#x425;&#x43E;&#x447;&#x430; &#x446;&#x435;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x456; &#x43D;&#x430;&#x437;&#x438;&#x432;&#x430;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x43E;&#x43C; ASCII (&#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x443; 7-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;), &#x43D;&#x430;&#x441;&#x43F;&#x440;&#x430;&#x432;&#x434;&#x456; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x443; &#x43D;&#x44C;&#x43E;&#x43C;&#x443; &#x454; 8-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x438;&#x43C;. &#x417;&#x430;&#x432;&#x436;&#x434;&#x438; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x446;&#x438;&#x43C; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x43E;&#x43C; &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 (Unicode).</p>
</dd>
<dt id="bit"><b>7bit</b></dt>
<dd>
<p>&#x423; &#x446;&#x44C;&#x43E;&#x43C;&#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x443;&#x441;&#x456; 8-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x456; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438;, &#x44F;&#x43A;&#x456; &#x43D;&#x435; &#x454; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x43E;&#x44E; ASCII, (&#x437; &#x43D;&#x43E;&#x43C;&#x435;&#x440;&#x430;&#x43C;&#x438; &#x432;&#x456;&#x434; 128 &#x434;&#x43E; 255) &#x431;&#x443;&#x434;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E; &#x43D;&#x430; &#x432;&#x456;&#x434;&#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43D;&#x456; 7-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x456; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438;.</p>
</dd>
<dt id="iso1"><b>iso</b></dt>
<dd>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x431;&#x443;&#x434;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x43D;&#x43E; &#x437; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; (&#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x43E;&#x457; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x438;) DOS &#x434;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; ISO-8859-1 (Latin-1) &#x443; Unix. &#x421;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x438; DOS, &#x44F;&#x43A;&#x456; &#x43D;&#x435; &#x43C;&#x430;&#x44E;&#x442;&#x44C; &#x435;&#x43A;&#x432;&#x456;&#x432;&#x430;&#x43B;&#x435;&#x43D;&#x442;&#x456;&#x432; &#x443; ISO-8859-1 &#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x44F;&#x43A;&#x438;&#x445; &#x43D;&#x435;&#x43C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x435;, &#x431;&#x443;&#x434;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E; &#x43D;&#x430; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B; &#x43A;&#x440;&#x430;&#x43F;&#x43A;&#x438;. &#x422;&#x435; &#x441;&#x430;&#x43C;&#x435; &#x441;&#x442;&#x43E;&#x441;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; ISO-8859-1, &#x44F;&#x43A;&#x456; &#x43D;&#x435; &#x43C;&#x430;&#x44E;&#x442;&#x44C; &#x435;&#x43A;&#x432;&#x456;&#x432;&#x430;&#x43B;&#x435;&#x43D;&#x442;&#x456;&#x432; &#x443; DOS.</p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x431;&#x443;&#x434;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43B;&#x438;&#x448;&#x435; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-iso</code>, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; dos2unix &#x441;&#x43F;&#x440;&#x43E;&#x431;&#x443;&#x454; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x438;&#x442;&#x438; &#x430;&#x43A;&#x442;&#x438;&#x432;&#x43D;&#x435; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;. &#x42F;&#x43A;&#x449;&#x43E; &#x446;&#x435; &#x432;&#x438;&#x44F;&#x432;&#x438;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x435;&#x43C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x438;&#x43C;, dos2unix &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x454; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x435; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; CP437, &#x44F;&#x43A;&#x435; &#x437;&#x434;&#x435;&#x431;&#x456;&#x43B;&#x44C;&#x448;&#x43E;&#x433;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x443; &#x421;&#x428;&#x410;. &#x429;&#x43E;&#x431; &#x43F;&#x440;&#x438;&#x43C;&#x443;&#x441;&#x43E;&#x432;&#x43E; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x438;&#x442;&#x438; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;, &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; <code>-437</code> (&#x421;&#x428;&#x410;), <code>-850</code> (&#x437;&#x430;&#x445;&#x456;&#x434;&#x43D;&#x43E;&#x454;&#x432;&#x440;&#x43E;&#x43F;&#x435;&#x439;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;), <code>-860</code> (&#x43F;&#x43E;&#x440;&#x442;&#x443;&#x433;&#x430;&#x43B;&#x44C;&#x441;&#x44C;&#x43A;&#x430;), <code>-863</code> (&#x43A;&#x430;&#x43D;&#x430;&#x434;&#x441;&#x44C;&#x43A;&#x430; &#x444;&#x440;&#x430;&#x43D;&#x446;&#x443;&#x437;&#x44C;&#x43A;&#x430;) &#x430;&#x431;&#x43E; <code>-865</code> (&#x441;&#x43A;&#x430;&#x43D;&#x434;&#x438;&#x43D;&#x430;&#x432;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;). &#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x442;&#x438; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; Windows CP1252 (&#x437;&#x430;&#x445;&#x456;&#x434;&#x43D;&#x43E;&#x454;&#x432;&#x440;&#x43E;&#x43F;&#x435;&#x439;&#x441;&#x44C;&#x43A;&#x456; &#x43C;&#x43E;&#x432;&#x438;) &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; <code>-1252</code>. &#x414;&#x43B;&#x44F; &#x456;&#x43D;&#x448;&#x438;&#x445; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x44C; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x439;&#x442;&#x435; &#x43F;&#x43E;&#x454;&#x434;&#x43D;&#x430;&#x43D;&#x43D;&#x44F; dos2unix &#x437; iconv(1). &#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; iconv &#x437;&#x434;&#x430;&#x442;&#x43D;&#x430; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x434;&#x43E;&#x432;&#x43E;&#x43B;&#x456; &#x448;&#x438;&#x440;&#x43E;&#x43A;&#x43E;&#x43C;&#x443; &#x441;&#x43F;&#x435;&#x43A;&#x442;&#x440;&#x456; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x44C; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432;.</p>
<p>&#x41D;&#x456;&#x43A;&#x43E;&#x43B;&#x438; &#x43D;&#x435; &#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x443;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;&#x43C; ISO &#x434;&#x43B;&#x44F; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Unicode. &#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x43F;&#x43E;&#x434;&#x456;&#x431;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x440;&#x438;&#x437;&#x432;&#x435;&#x434;&#x435; &#x434;&#x43E; &#x443;&#x448;&#x43A;&#x43E;&#x434;&#x436;&#x435;&#x43D;&#x43D;&#x44F; &#x432;&#x43C;&#x456;&#x441;&#x442;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8.</p>
<p>&#x414;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x430; &#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;&#x456;&#x432;:</p>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; DOS &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix:</p>
<pre><code> dos2unix -iso -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; DOS CP850 &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix:</p>
<pre><code> dos2unix -850 -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; CP1252 Windows &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix:</p>
<pre><code> dos2unix -1252 -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; CP252 Windows &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 Unix (Unicode):</p>
<pre><code> iconv -f CP1252 -t UTF-8 in.txt | dos2unix &gt; out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; DOS:</p>
<pre><code> unix2dos -iso -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; DOS CP850:</p>
<pre><code> unix2dos -850 -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Latin-1 Unix &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Windows CP1252:</p>
<pre><code> unix2dos -1252 -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 Unix (Unicode) &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Windows CP1252:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t CP1252 &gt; out.txt</code></pre>
<p>&#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; <a href="http://czyborra.com/charsets/codepages.html">http://czyborra.com/charsets/codepages.html</a> &#x442;&#x430; <a href="http://czyborra.com/charsets/iso8859.html">http://czyborra.com/charsets/iso8859.html</a>.</p>
</dd>
</dl>
<h1 id="UNICODE">UNICODE</h1>
<h2 id="5">&#x41A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;</h2>
<p>&#x406;&#x441;&#x43D;&#x443;&#x454; &#x434;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x430; &#x440;&#x456;&#x437;&#x43D;&#x438;&#x445; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x44C; Unicode. &#x423; Unix &#x442;&#x430; Linux &#x443; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; Unicode &#x437;&#x434;&#x435;&#x431;&#x456;&#x43B;&#x44C;&#x448;&#x43E;&#x433;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-8. &#x423; Windows &#x434;&#x43B;&#x44F; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; Unicode &#x43C;&#x43E;&#x436;&#x435; &#x431;&#x443;&#x442;&#x438; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-8, UTF-16 &#x430;&#x431;&#x43E; UTF-16 &#x437;&#x456; &#x437;&#x432;&#x43E;&#x440;&#x43E;&#x442;&#x43D;&#x438;&#x43C; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x43E;&#x43C; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;. &#x412;&#x442;&#x456;&#x43C;, &#x437;&#x434;&#x435;&#x431;&#x456;&#x43B;&#x44C;&#x448;&#x43E;&#x433;&#x43E;, &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; UTF-16.</p>
<h2 id="6">&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;</h2>
<p>&#x423; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; Unicode, &#x44F;&#x43A; &#x456; &#x443; &#x437;&#x432;&#x438;&#x447;&#x430;&#x439;&#x43D;&#x438;&#x445; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445;, &#x43C;&#x43E;&#x436;&#x435; &#x431;&#x443;&#x442;&#x438; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x440;&#x43E;&#x437;&#x440;&#x438;&#x432;&#x438; &#x440;&#x44F;&#x434;&#x43A;&#x456;&#x432; DOS, Unix &#x430;&#x431;&#x43E; Mac.</p>
<p>&#x423;&#x441;&#x456; &#x432;&#x435;&#x440;&#x441;&#x456;&#x457; dos2unix &#x442;&#x430; unix2dos &#x437;&#x434;&#x430;&#x442;&#x43D;&#x456; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x443;&#x432;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8, &#x43E;&#x441;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x438; UTF-8 &#x431;&#x443;&#x43B;&#x43E; &#x440;&#x43E;&#x437;&#x440;&#x43E;&#x431;&#x43B;&#x435;&#x43D;&#x43E; &#x442;&#x430;&#x43A;, &#x449;&#x43E; &#x437;&#x432;&#x43E;&#x440;&#x43E;&#x442;&#x43D;&#x443; &#x441;&#x443;&#x43C;&#x456;&#x441;&#x43D;&#x456;&#x441;&#x442;&#x44C; &#x437; ASCII &#x437;&#x431;&#x435;&#x440;&#x435;&#x436;&#x435;&#x43D;&#x43E;.</p>
<p>&#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x438; dos2unix &#x442;&#x430; unix2dos, &#x437;&#x456;&#x431;&#x440;&#x430;&#x43D;&#x456; &#x437; &#x43F;&#x456;&#x434;&#x442;&#x440;&#x438;&#x43C;&#x43A;&#x43E;&#x44E; Unicode UTF-16, &#x43C;&#x43E;&#x436;&#x443;&#x442;&#x44C; &#x447;&#x438;&#x442;&#x430;&#x442;&#x438; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x456; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16 &#x437; &#x43F;&#x440;&#x44F;&#x43C;&#x438;&#x43C; &#x442;&#x430; &#x437;&#x432;&#x43E;&#x440;&#x43E;&#x442;&#x43D;&#x438;&#x43C; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x43E;&#x43C; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;. &#x429;&#x43E;&#x431; &#x434;&#x456;&#x437;&#x43D;&#x430;&#x442;&#x438;&#x441;&#x44F; &#x43F;&#x440;&#x43E; &#x442;&#x435;, &#x447;&#x438; &#x431;&#x443;&#x43B;&#x43E; dos2unix &#x437;&#x456;&#x431;&#x440;&#x430;&#x43D;&#x43E; &#x437; &#x43F;&#x456;&#x434;&#x442;&#x440;&#x438;&#x43C;&#x43A;&#x43E;&#x44E; UTF-16, &#x432;&#x456;&#x434;&#x434;&#x430;&#x439;&#x442;&#x435; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x443; <code>dos2unix -V</code>.</p>
<p>&#x423; Unix/Linux &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16 &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x44E;&#x44E;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456;. &#x414;&#x43B;&#x44F; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x43E;&#x442;&#x43E;&#x447;&#x43D;&#x43E;&#x433;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x456;&#x432; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456; &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43E;&#x44E; locale(1). &#x42F;&#x43A;&#x449;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x432;&#x438;&#x44F;&#x432;&#x438;&#x442;&#x44C;&#x441;&#x44F; &#x43D;&#x435;&#x43C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x438;&#x43C;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x438;&#x442;&#x44C; &#x43F;&#x440;&#x43E; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x443; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x456; &#x43F;&#x440;&#x43E;&#x43F;&#x443;&#x441;&#x442;&#x438;&#x442;&#x44C; &#x432;&#x456;&#x434;&#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43D;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B;.</p>
<p>&#x423; Windows &#x444;&#x430;&#x439;&#x43B;&#x438; UTF-16 &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x431;&#x443;&#x434;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E; &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; UTF-8. &#x41E;&#x431;&#x438;&#x434;&#x432;&#x430; &#x442;&#x438;&#x43F;&#x438; &#x441;&#x438;&#x441;&#x442;&#x435;&#x43C;, Windows &#x442;&#x430; Unix/Linux, &#x43C;&#x430;&#x44E;&#x442;&#x44C; &#x43D;&#x435;&#x43F;&#x43E;&#x433;&#x430;&#x43D;&#x456; &#x43C;&#x43E;&#x436;&#x43B;&#x438;&#x432;&#x43E;&#x441;&#x442;&#x456; &#x437; &#x43F;&#x456;&#x434;&#x442;&#x440;&#x438;&#x43C;&#x43A;&#x438; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8.</p>
<p>&#x41A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-16 &#x442;&#x430; UTF-8 &#x454; &#x43F;&#x43E;&#x432;&#x43D;&#x456;&#x441;&#x442;&#x44E; &#x441;&#x443;&#x43C;&#x456;&#x441;&#x43D;&#x438;&#x43C;&#x438;. &#x41F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43D;&#x435; &#x431;&#x443;&#x434;&#x435; &#x432;&#x442;&#x440;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x436;&#x43E;&#x434;&#x43D;&#x43E;&#x457; &#x456;&#x43D;&#x444;&#x43E;&#x440;&#x43C;&#x430;&#x446;&#x456;&#x457;. &#x42F;&#x43A;&#x449;&#x43E; &#x43F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16 &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 &#x442;&#x440;&#x430;&#x43F;&#x438;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x430;, &#x43D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;, &#x44F;&#x43A;&#x449;&#x43E; &#x443; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x43E;&#x43C;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; UTF-16 &#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438;&#x43C;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x44F;&#x43A;&#x430;&#x441;&#x44C; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x430;, &#x444;&#x430;&#x439;&#x43B; &#x431;&#x443;&#x434;&#x435; &#x43F;&#x440;&#x43E;&#x43F;&#x443;&#x449;&#x435;&#x43D;&#x43E;.</p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-u</code>, &#x444;&#x430;&#x439;&#x43B; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x431;&#x443;&#x434;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x43D;&#x43E; &#x443; &#x442;&#x43E;&#x43C;&#x443; &#x441;&#x430;&#x43C;&#x43E;&#x43C;&#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16, &#x449;&#x43E; &#x456; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x412;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43D;&#x44F; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; Option <code>-u</code> &#x437;&#x430;&#x43F;&#x43E;&#x431;&#x456;&#x433;&#x430;&#x454; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44E; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-8.</p>
<p>&#x423; dos2unix &#x442;&#x430; unix2dos &#x43D;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x434;&#x431;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-16.</p>
<p>&#x420;&#x435;&#x436;&#x438;&#x43C; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; ISO &#x442;&#x430; 7-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x435;&#x436;&#x438;&#x43C; &#x43D;&#x435; &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x44E;&#x442;&#x44C; &#x434;&#x43B;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; UTF-16.</p>
<h2 id="7">&#x41F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;</h2>
<p>&#x423; Windows &#x434;&#x43E; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Unicode &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x434;&#x43E;&#x43F;&#x438;&#x441;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM), &#x43E;&#x441;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x438; &#x431;&#x430;&#x433;&#x430;&#x442;&#x43E; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C; Windows (&#x437;&#x43E;&#x43A;&#x440;&#x435;&#x43C;&#x430; Notepad) &#x434;&#x43E;&#x434;&#x430;&#x44E;&#x442;&#x44C; &#x442;&#x430;&#x43A;&#x443; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x430;&#x432;&#x442;&#x43E;&#x43C;&#x430;&#x442;&#x438;&#x447;&#x43D;&#x43E;. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; <a href="http://en.wikipedia.org/wiki/Byte_order_mark">http://en.wikipedia.org/wiki/Byte_order_mark</a>.</p>
<p>&#x423; Unix &#x444;&#x430;&#x439;&#x43B;&#x438; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Unicode &#x442;&#x438;&#x43F;&#x43E;&#x432;&#x43E; &#x43D;&#x435; &#x43C;&#x456;&#x441;&#x442;&#x44F;&#x442;&#x44C; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x438; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;. &#x412;&#x432;&#x430;&#x436;&#x430;&#x454;&#x442;&#x44C;&#x441;&#x44F;, &#x449;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x454; &#x442;&#x435; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;, &#x44F;&#x43A;&#x435; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x43E;&#x442;&#x43E;&#x447;&#x43D;&#x43E;&#x44E; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x43B;&#x44E;.</p>
<p>&#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; dos2unix &#x43C;&#x43E;&#x436;&#x435; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x438;&#x442;&#x438;, &#x447;&#x438; &#x454; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x444;&#x430;&#x439;&#x43B;&#x430; UTF-16, &#x43B;&#x438;&#x448;&#x435; &#x44F;&#x43A;&#x449;&#x43E; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; &#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;. &#x42F;&#x43A;&#x449;&#x43E; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;, &#x434;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-16, &#x43D;&#x435;&#x43C;&#x430;&#x454; &#x442;&#x430;&#x43A;&#x43E;&#x457; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x438;, dos2unix &#x432;&#x432;&#x430;&#x436;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x442;&#x430;&#x43A;&#x438;&#x439; &#x444;&#x430;&#x439;&#x43B; &#x434;&#x432;&#x456;&#x439;&#x43A;&#x43E;&#x432;&#x438;&#x43C; (&#x431;&#x456;&#x43D;&#x430;&#x440;&#x43D;&#x438;&#x43C;).</p>
<p>&#x414;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; UTF-16 &#x431;&#x435;&#x437; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x438; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; <code>-ul</code> &#x430;&#x431;&#x43E; <code>-ub</code>.</p>
<p>&#x422;&#x438;&#x43F;&#x43E;&#x432;&#x43E; dos2unix &#x43D;&#x435; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x454; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x438; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM). &#x42F;&#x43A;&#x449;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-b</code>, dos2unix &#x437;&#x430;&#x43F;&#x438;&#x448;&#x435; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; BOM, &#x44F;&#x43A;&#x449;&#x43E; BOM &#x431;&#x443;&#x43B;&#x430; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x445; &#x434;&#x430;&#x43D;&#x438;&#x445;.</p>
<p>&#x422;&#x438;&#x43F;&#x43E;&#x432;&#x43E; unix2dos &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x454; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM) &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432;, &#x44F;&#x43A;&#x449;&#x43E; BOM &#x454; &#x443; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x43C;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;. &#x421;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x439;&#x442;&#x435;&#x441;&#x44F; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x43E;&#x43C; <code>-r</code>, &#x449;&#x43E;&#x431; &#x432;&#x438;&#x43B;&#x443;&#x447;&#x438;&#x442;&#x438; BOM.</p>
<p>Dos2unix &#x442;&#x430; unix2dos &#x437;&#x430;&#x432;&#x436;&#x434;&#x438; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x44E;&#x442;&#x44C; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x456;&#x432; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM), &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x43D;&#x43E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-m</code>.</p>
<h2 id="Unicode">&#x41F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;&#x438; &#x434;&#x43B;&#x44F; Unicode</h2>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x437; Windows UTF-16 (&#x437; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x43E;&#x44E; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432; (BOM)) &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; Unix UTF-8:</p>
<pre><code> dos2unix -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; Windows UTF-16LE (&#x431;&#x435;&#x437; BOM) &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x456; UTF-8 Unix:</p>
<pre><code> dos2unix -ul -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 Unix &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Windows UTF-8 &#x431;&#x435;&#x437; BOM:</p>
<pre><code> unix2dos -m -n in.txt out.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; UTF-8 Unix &#x43D;&#x430; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Windows UTF-16:</p>
<pre><code> unix2dos &lt; in.txt | iconv -f UTF-8 -t UTF-16 &gt; out.txt</code></pre>
<h1 id="GB18030">GB18030</h1>
<p>GB18030 &#x454; &#x43A;&#x438;&#x442;&#x430;&#x439;&#x441;&#x44C;&#x43A;&#x438;&#x43C; &#x443;&#x440;&#x44F;&#x434;&#x43E;&#x432;&#x438;&#x43C; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x43E;&#x43C;. &#x41F;&#x456;&#x434;&#x442;&#x440;&#x438;&#x43C;&#x43A;&#x430; &#x43E;&#x431;&#x43E;&#x432;&rsquo;&#x44F;&#x437;&#x43A;&#x43E;&#x432;&#x43E;&#x457; &#x43F;&#x456;&#x434;&#x43C;&#x43D;&#x43E;&#x436;&#x438;&#x43D;&#x438; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x443; GB18030 &#x454; &#x43D;&#x435;&#x43E;&#x434;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x44E; &#x432;&#x438;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x434;&#x43E; &#x431;&#x443;&#x434;&#x44C;-&#x44F;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x43D;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x434;&#x443;&#x43A;&#x442;&#x456;&#x432;, &#x44F;&#x43A;&#x456; &#x43F;&#x440;&#x43E;&#x434;&#x430;&#x44E;&#x442;&#x44C;&#x441;&#x44F; &#x443; &#x41A;&#x438;&#x442;&#x430;&#x457;. &#x414;&#x438;&#x432;. &#x442;&#x430;&#x43A;&#x43E;&#x436; <a href="http://en.wikipedia.org/wiki/GB_18030">http://en.wikipedia.org/wiki/GB_18030</a>.</p>
<p>&#x41A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; GB18030 &#x454; &#x43F;&#x43E;&#x432;&#x43D;&#x456;&#x441;&#x442;&#x44E; &#x441;&#x443;&#x43C;&#x456;&#x441;&#x43D;&#x438;&#x43C; &#x456;&#x437; Unicode. &#x419;&#x43E;&#x433;&#x43E; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x440;&#x43E;&#x437;&#x433;&#x43B;&#x44F;&#x434;&#x430;&#x442;&#x438; &#x44F;&#x43A; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; unicode. &#x41F;&#x43E;&#x434;&#x456;&#x431;&#x43D;&#x43E; &#x434;&#x43E; UTF-8, GB18030 &#x454; &#x441;&#x443;&#x43C;&#x456;&#x441;&#x43D;&#x438;&#x43C; &#x456;&#x437; ASCII. GB18030 &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x454; &#x441;&#x443;&#x43C;&#x456;&#x441;&#x43D;&#x438;&#x43C; &#x456;&#x437; &#x43A;&#x43E;&#x434;&#x43E;&#x432;&#x43E;&#x44E; &#x441;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x43E;&#x44E; Windows 936, &#x44F;&#x43A;&#x443; &#x449;&#x435; &#x43D;&#x430;&#x437;&#x438;&#x432;&#x430;&#x44E;&#x442;&#x44C; GBK.</p>
<p>&#x423; Unix/Linux &#x444;&#x430;&#x439;&#x43B;&#x438; UTF-16 &#x431;&#x443;&#x434;&#x435; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43E; &#x434;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; GB18030, &#x44F;&#x43A;&#x449;&#x43E; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;&#x43C; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456; &#x454; GB18030. &#x417;&#x430;&#x443;&#x432;&#x430;&#x436;&#x442;&#x435;, &#x449;&#x43E; &#x446;&#x435; &#x441;&#x43F;&#x440;&#x430;&#x446;&#x44E;&#x454;, &#x43B;&#x438;&#x448;&#x435; &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x43E; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x43A;&#x440;&#x430;&#x457;&#x43D;&#x438; &#x41A;&#x41D;&#x420;. &#x41D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;, &#x443; &#x430;&#x43D;&#x433;&#x43B;&#x456;&#x439;&#x441;&#x44C;&#x43A;&#x456;&#x439; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456; &#x434;&#x43B;&#x44F; &#x412;&#x435;&#x43B;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x442;&#x430;&#x43D;&#x456;&#x457; &#x456;&#x437; &#x432;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x43E;&#x44E; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x43B;&#x44E; <code>en_GB.GB18030</code> &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; UTF-16 &#x43D;&#x430; GB18030 &#x43D;&#x435; &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435;, &#x430; &#x443; &#x43A;&#x438;&#x442;&#x430;&#x439;&#x441;&#x44C;&#x43A;&#x456;&#x439; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456; <code>zh_CN.GB18030</code> &#x432;&#x441;&#x435; &#x43F;&#x440;&#x430;&#x446;&#x44E;&#x432;&#x430;&#x442;&#x438;&#x43C;&#x435; &#x44F;&#x43A; &#x441;&#x43B;&#x456;&#x434;.</p>
<p>&#x423; Windows &#x434;&#x43B;&#x44F; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; UTF-16 &#x43D;&#x430; &#x444;&#x430;&#x439;&#x43B;&#x438; GB18030 &#x441;&#x43B;&#x456;&#x434; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x442;&#x438; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440; <code>-gb</code>.</p>
<p>&#x423; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; GB18030 &#x43C;&#x43E;&#x436;&#x435; &#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438;&#x441;&#x44F; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x430; &#x43F;&#x43E;&#x440;&#x44F;&#x434;&#x43A;&#x443; &#x431;&#x430;&#x439;&#x442;&#x456;&#x432;, &#x442;&#x430;&#x43A; &#x441;&#x430;&#x43C;&#x43E;, &#x44F;&#x43A; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x430;&#x445; &#x443; &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x456; Unicode.</p>
<h1 id="8">&#x41F;&#x420;&#x418;&#x41A;&#x41B;&#x410;&#x414;&#x418;</h1>
<p>&#x41F;&#x440;&#x43E;&#x447;&#x438;&#x442;&#x430;&#x442;&#x438; &#x432;&#x445;&#x456;&#x434;&#x43D;&#x456; &#x434;&#x430;&#x43D;&#x456; &#x437;&#x456; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x43D;&#x43E;&#x433;&#x43E; &#x434;&#x436;&#x435;&#x440;&#x435;&#x43B;&#x430; (stdin) &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442; &#x434;&#x43E; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x43D;&#x43E;&#x433;&#x43E; &#x432;&#x438;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43D;&#x44F; (stdout):</p>
<pre><code> dos2unix
dos2unix -l -c mac</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; b.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B;:</p>
<pre><code> dos2unix a.txt b.txt
dos2unix -o a.txt b.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B; &#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; ascii:</p>
<pre><code> dos2unix a.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B; &#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; ascii. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; b.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B; &#x443; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; 7-&#x431;&#x456;&#x442;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F;:</p>
<pre><code> dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B; a.txt &#x437; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443; Mac &#x43D;&#x430; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; Unix:</p>
<pre><code> dos2unix -c mac a.txt
mac2unix a.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x444;&#x430;&#x439;&#x43B; a.txt &#x437; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442;&#x443; Unix &#x43D;&#x430; &#x444;&#x43E;&#x440;&#x43C;&#x430;&#x442; Mac:</p>
<pre><code> unix2dos -c mac a.txt
unix2mac a.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt, &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B; &#x456; &#x437;&#x431;&#x435;&#x440;&#x435;&#x433;&#x442;&#x438; &#x447;&#x430;&#x441;&#x43E;&#x432;&#x443; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x43E;&#x433;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430;:</p>
<pre><code> dos2unix -k a.txt
dos2unix -k -o a.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; a.txt &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; e.txt:</p>
<pre><code> dos2unix -n a.txt e.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; &#x444;&#x430;&#x439;&#x43B;&#x456; a.txt &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E; &#x444;&#x430;&#x439;&#x43B;&#x430; e.txt. &#x421;&#x43A;&#x43E;&#x43F;&#x456;&#x44E;&#x432;&#x430;&#x442;&#x438; &#x447;&#x430;&#x441;&#x43E;&#x432;&#x443; &#x43F;&#x43E;&#x437;&#x43D;&#x430;&#x447;&#x43A;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x430; a.txt &#x434;&#x43B;&#x44F; &#x444;&#x430;&#x439;&#x43B;&#x430; e.txt:</p>
<pre><code> dos2unix -k -n a.txt e.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; b.txt &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442; &#x434;&#x43E; e.txt:</p>
<pre><code> dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt</code></pre>
<p>&#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; c.txt &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E; e.txt. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; a.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x43D;&#x438;&#x43C;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; b.txt &#x456; &#x437;&#x430;&#x43C;&#x456;&#x441;&#x442;&#x438;&#x442;&#x438; &#x43D;&#x438;&#x43C;&#x438; &#x446;&#x435;&#x439; &#x444;&#x430;&#x439;&#x43B;. &#x41F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x438;&#x442;&#x438; &#x434;&#x430;&#x43D;&#x456; &#x443; d.txt &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x430;&#x442;&#x438; &#x440;&#x435;&#x437;&#x443;&#x43B;&#x44C;&#x442;&#x430;&#x442;&#x438; &#x434;&#x43E; f.txt:</p>
<pre><code> dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt</code></pre>
<h1 id="9">&#x420;&#x415;&#x41A;&#x423;&#x420;&#x421;&#x418;&#x412;&#x41D;&#x415; &#x41F;&#x415;&#x420;&#x415;&#x422;&#x412;&#x41E;&#x420;&#x415;&#x41D;&#x41D;&#x42F;</h1>
<p>&#x414;&#x43B;&#x44F; &#x440;&#x435;&#x43A;&#x443;&#x440;&#x441;&#x438;&#x432;&#x43D;&#x43E;&#x433;&#x43E; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x442;&#x435;&#x43A;&#x441;&#x442;&#x43E;&#x432;&#x438;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x443; &#x456;&#x454;&#x440;&#x430;&#x440;&#x445;&#x456;&#x457; &#x43A;&#x430;&#x442;&#x430;&#x43B;&#x43E;&#x433;&#x456;&#x432; &#x441;&#x43B;&#x456;&#x434; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; dos2unix &#x443; &#x43F;&#x43E;&#x454;&#x434;&#x43D;&#x430;&#x43D;&#x43D;&#x456; &#x437; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430;&#x43C;&#x438; find(1) &#x442;&#x430; xargs(1). &#x41D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;, &#x449;&#x43E;&#x431; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438; &#x43F;&#x435;&#x440;&#x435;&#x442;&#x432;&#x43E;&#x440;&#x435;&#x43D;&#x43D;&#x44F; &#x443;&#x441;&#x456;&#x445; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; .txt &#x443; &#x441;&#x442;&#x440;&#x443;&#x43A;&#x442;&#x443;&#x440;&#x456; &#x43F;&#x456;&#x434;&#x43A;&#x430;&#x442;&#x430;&#x43B;&#x43E;&#x433;&#x456;&#x432; &#x43F;&#x43E;&#x442;&#x43E;&#x447;&#x43D;&#x43E;&#x433;&#x43E; &#x43A;&#x430;&#x442;&#x430;&#x43B;&#x43E;&#x433;&#x443;, &#x432;&#x456;&#x434;&#x434;&#x430;&#x439;&#x442;&#x435; &#x442;&#x430;&#x43A;&#x443; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x443;:</p>
<pre><code> find . -name *.txt |xargs dos2unix</code></pre>
<h1 id="10">&#x41B;&#x41E;&#x41A;&#x410;&#x41B;&#x406;&#x417;&#x410;&#x426;&#x406;&#x42F;</h1>
<dl>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>&#x41E;&#x441;&#x43D;&#x43E;&#x432;&#x43D;&#x430; &#x43C;&#x43E;&#x432;&#x430; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; &#x441;&#x435;&#x440;&#x435;&#x434;&#x43E;&#x432;&#x438;&#x449;&#x430; LANG. &#x417;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; LANG &#x441;&#x43A;&#x43B;&#x430;&#x434;&#x430;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x437; &#x434;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x43E;&#x445; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;. &#x41F;&#x435;&#x440;&#x448;&#x430; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x430; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x43C;&#x430;&#x43B;&#x438;&#x43C;&#x438; &#x43B;&#x456;&#x442;&#x435;&#x440;&#x430;&#x43C;&#x438; &#x456; &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x454; &#x43A;&#x43E;&#x434; &#x43C;&#x43E;&#x432;&#x438;. &#x414;&#x440;&#x443;&#x433;&#x430; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x430; &#x454; &#x43D;&#x435;&#x43E;&#x431;&#x43E;&#x432;&rsquo;&#x44F;&#x437;&#x43A;&#x43E;&#x432;&#x43E;&#x44E;, &#x432;&#x438;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x454; &#x43A;&#x43E;&#x434; &#x43A;&#x440;&#x430;&#x457;&#x43D;&#x438; &#x456; &#x437;&#x430;&#x43F;&#x438;&#x441;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x43F;&#x440;&#x43E;&#x43F;&#x438;&#x441;&#x43D;&#x438;&#x43C;&#x438; &#x43B;&#x456;&#x442;&#x435;&#x440;&#x430;&#x43C;&#x438;, &#x432;&#x456;&#x434;&#x43E;&#x43A;&#x440;&#x435;&#x43C;&#x43B;&#x44E;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x432;&#x456;&#x434; &#x43F;&#x435;&#x440;&#x448;&#x43E;&#x457; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x438; &#x441;&#x438;&#x43C;&#x432;&#x43E;&#x43B;&#x43E;&#x43C; &#x43F;&#x456;&#x434;&#x43A;&#x440;&#x435;&#x441;&#x43B;&#x44E;&#x432;&#x430;&#x43D;&#x43D;&#x44F;. &#x41F;&#x435;&#x440;&#x435;&#x434;&#x431;&#x430;&#x447;&#x435;&#x43D;&#x43E; &#x442;&#x430;&#x43A;&#x43E;&#x436; &#x43D;&#x435;&#x43E;&#x431;&#x43E;&#x432;&rsquo;&#x44F;&#x437;&#x43A;&#x43E;&#x432;&#x443; &#x442;&#x440;&#x435;&#x442;&#x44E; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x443;: &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F;. &#x426;&#x44F; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x430; &#x432;&#x456;&#x434;&#x43E;&#x43A;&#x440;&#x435;&#x43C;&#x43B;&#x44E;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x432;&#x456;&#x434; &#x434;&#x440;&#x443;&#x433;&#x43E;&#x457; &#x447;&#x430;&#x441;&#x442;&#x438;&#x43D;&#x438; &#x43A;&#x440;&#x430;&#x43F;&#x43A;&#x43E;&#x44E;. &#x41E;&#x441;&#x44C; &#x434;&#x435;&#x43A;&#x456;&#x43B;&#x44C;&#x43A;&#x430; &#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;&#x456;&#x432; &#x434;&#x43B;&#x44F; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43D;&#x438;&#x445; &#x43E;&#x431;&#x43E;&#x43B;&#x43E;&#x43D;&#x43E;&#x43A; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x43D;&#x43E;&#x433;&#x43E; &#x442;&#x438;&#x43F;&#x443; POSIX:</p>
<pre><code> export LANG=uk &#x443;&#x43A;&#x440;&#x430;&#x457;&#x43D;&#x441;&#x44C;&#x43A;&#x430;
export LANG=uk_UA &#x443;&#x43A;&#x440;&#x430;&#x457;&#x43D;&#x441;&#x44C;&#x43A;&#x430;, &#x423;&#x43A;&#x440;&#x430;&#x457;&#x43D;&#x430;
export LANG=ru_UA &#x440;&#x43E;&#x441;&#x456;&#x439;&#x441;&#x44C;&#x43A;&#x430;, &#x423;&#x43A;&#x440;&#x430;&#x457;&#x43D;&#x430;
export LANG=es_ES &#x456;&#x441;&#x43F;&#x430;&#x43D;&#x441;&#x44C;&#x43A;&#x430;, &#x406;&#x441;&#x43F;&#x430;&#x43D;&#x456;&#x44F;
export LANG=es_MX &#x456;&#x441;&#x43F;&#x430;&#x43D;&#x441;&#x44C;&#x43A;&#x430;, &#x41C;&#x435;&#x43A;&#x441;&#x438;&#x43A;&#x430;
export LANG=en_US.iso88591 &#x430;&#x43D;&#x433;&#x43B;&#x456;&#x439;&#x441;&#x44C;&#x43A;&#x430;, &#x421;&#x428;&#x410;, &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; Latin-1
export LANG=en_GB.UTF-8 &#x430;&#x43D;&#x433;&#x43B;&#x456;&#x439;&#x441;&#x44C;&#x43A;&#x430;, &#x412;&#x435;&#x43B;&#x438;&#x43A;&#x43E;&#x431;&#x440;&#x438;&#x442;&#x430;&#x43D;&#x456;&#x44F;, &#x43A;&#x43E;&#x434;&#x443;&#x432;&#x430;&#x43D;&#x43D;&#x44F; UTF-8</code></pre>
<p>&#x41F;&#x43E;&#x432;&#x43D;&#x438;&#x439; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x43C;&#x43E;&#x432; &#x442;&#x430; &#x43A;&#x43E;&#x434;&#x456;&#x432; &#x43A;&#x440;&#x430;&#x457;&#x43D; &#x43D;&#x430;&#x432;&#x435;&#x434;&#x435;&#x43D;&#x43E; &#x443; &#x43F;&#x456;&#x434;&#x440;&#x443;&#x447;&#x43D;&#x438;&#x43A;&#x443; &#x437; gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html">http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html</a></p>
<p>&#x423; &#x441;&#x438;&#x441;&#x442;&#x435;&#x43C;&#x430;&#x445; Unix &#x434;&#x43B;&#x44F; &#x43E;&#x442;&#x440;&#x438;&#x43C;&#x430;&#x43D;&#x43D;&#x44F; &#x434;&#x430;&#x43D;&#x438;&#x445; &#x449;&#x43E;&#x434;&#x43E; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x441;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x430;&#x442;&#x438;&#x441;&#x44F; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43E;&#x44E; locale(1).</p>
</dd>
<dt id="LANGUAGE"><b>LANGUAGE</b></dt>
<dd>
<p>&#x417;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; &#x441;&#x435;&#x440;&#x435;&#x434;&#x43E;&#x432;&#x438;&#x449;&#x430; LANGUAGE &#x432;&#x438; &#x43C;&#x43E;&#x436;&#x435;&#x442;&#x435; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x442;&#x438; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x43F;&#x440;&#x456;&#x43E;&#x440;&#x438;&#x442;&#x435;&#x43D;&#x43E;&#x441;&#x442;&#x456; &#x43C;&#x43E;&#x432;. &#x417;&#x430;&#x43F;&#x438;&#x441;&#x438; &#x443; &#x441;&#x43F;&#x438;&#x441;&#x43A;&#x443; &#x441;&#x43B;&#x456;&#x434; &#x432;&#x456;&#x434;&#x43E;&#x43A;&#x440;&#x435;&#x43C;&#x43B;&#x44E;&#x432;&#x430;&#x442;&#x438; &#x434;&#x432;&#x43E;&#x43A;&#x440;&#x430;&#x43F;&#x43A;&#x430;&#x43C;&#x438;. &#x41F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; dos2unix &#x43D;&#x430;&#x434;&#x430;&#x454; &#x43F;&#x435;&#x440;&#x435;&#x432;&#x430;&#x433;&#x443; LANGUAGE &#x43D;&#x430;&#x434; LANG. &#x41D;&#x430;&#x43F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434;, &#x43F;&#x435;&#x440;&#x448;&#x430; &#x433;&#x43E;&#x43B;&#x43B;&#x430;&#x43D;&#x434;&#x441;&#x44C;&#x43A;&#x430;, &#x434;&#x430;&#x43B;&#x456; &#x43D;&#x456;&#x43C;&#x435;&#x446;&#x44C;&#x43A;&#x430;: <code>LANGUAGE=nl:de</code>. &#x421;&#x43F;&#x43E;&#x447;&#x430;&#x442;&#x43A;&#x443; &#x432;&#x430;&#x43C; &#x441;&#x43B;&#x456;&#x434; &#x443;&#x432;&#x456;&#x43C;&#x43A;&#x43D;&#x443;&#x442;&#x438; &#x43B;&#x43E;&#x43A;&#x430;&#x43B;&#x456;&#x437;&#x430;&#x446;&#x456;&#x44E;, &#x432;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x438;&#x432;&#x448;&#x438; &#x434;&#x43B;&#x44F; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; LANG (&#x430;&#x431;&#x43E; LC_ALL) &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F;, &#x432;&#x456;&#x434;&#x43C;&#x456;&#x43D;&#x43D;&#x435; &#x432;&#x456;&#x434; &laquo;C&raquo;. &#x414;&#x430;&#x43B;&#x456; &#x432;&#x438; &#x437;&#x43C;&#x43E;&#x436;&#x435;&#x442;&#x435; &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x432;&#x430;&#x442;&#x438; &#x441;&#x43F;&#x438;&#x441;&#x43E;&#x43A; &#x43F;&#x440;&#x456;&#x43E;&#x440;&#x438;&#x442;&#x435;&#x442;&#x43D;&#x43E;&#x441;&#x442;&#x456; &#x43C;&#x43E;&#x432; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; LANGUAGE. &#x414;&#x43E;&#x434;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x456; &#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43E;&#x441;&#x442;&#x456; &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x43D;&#x430;&#x439;&#x442;&#x438; &#x443; &#x43F;&#x456;&#x434;&#x440;&#x443;&#x447;&#x43D;&#x438;&#x43A;&#x443; &#x437; gettext: <a href="http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html">http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html</a></p>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x432;&#x430;&#x43C;&#x438; &#x431;&#x443;&#x434;&#x435; &#x432;&#x438;&#x431;&#x440;&#x430;&#x43D;&#x43E; &#x43C;&#x43E;&#x432;&#x443;, &#x43F;&#x435;&#x440;&#x435;&#x43A;&#x43B;&#x430;&#x434;&#x443; &#x44F;&#x43A;&#x43E;&#x44E; &#x43D;&#x435;&#x43C;&#x430;&#x454;, &#x431;&#x443;&#x434;&#x435; &#x43F;&#x43E;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43E; &#x441;&#x442;&#x430;&#x43D;&#x434;&#x430;&#x440;&#x442;&#x43D;&#x456; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x43D;&#x44F; &#x430;&#x43D;&#x433;&#x43B;&#x456;&#x439;&#x441;&#x44C;&#x43A;&#x43E;&#x44E; &#x43C;&#x43E;&#x432;&#x43E;&#x44E;.</p>
</dd>
<dt id="DOS2UNIX_LOCALEDIR"><b>DOS2UNIX_LOCALEDIR</b></dt>
<dd>
<p>&#x417;&#x43C;&#x456;&#x43D;&#x43D;&#x443; LOCALEDIR, &#x432;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x443; &#x43F;&#x456;&#x434; &#x447;&#x430;&#x441; &#x437;&#x431;&#x438;&#x440;&#x430;&#x43D;&#x43D;&#x44F; &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x438;, &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x437;&#x43C;&#x456;&#x43D;&#x438;&#x442;&#x438; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; &#x441;&#x435;&#x440;&#x435;&#x434;&#x43E;&#x432;&#x438;&#x449;&#x430; DOS2UNIX_LOCALEDIR. LOCALEDIR &#x432;&#x438;&#x43A;&#x43E;&#x440;&#x438;&#x441;&#x442;&#x43E;&#x432;&#x443;&#x454;&#x442;&#x44C;&#x441;&#x44F; &#x434;&#x43B;&#x44F; &#x43F;&#x43E;&#x448;&#x443;&#x43A;&#x443; &#x444;&#x430;&#x439;&#x43B;&#x456;&#x432; &#x43F;&#x435;&#x440;&#x435;&#x43A;&#x43B;&#x430;&#x434;&#x456;&#x432;. &#x422;&#x438;&#x43F;&#x43E;&#x432;&#x438;&#x43C; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F;&#x43C; &#x443; &#x441;&#x438;&#x441;&#x442;&#x435;&#x43C;&#x430;&#x445; GNU &#x454; <code>/usr/local/share/locale</code>. &#x41F;&#x435;&#x440;&#x435;&#x433;&#x43B;&#x44F;&#x43D;&#x443;&#x442;&#x438; &#x43F;&#x43E;&#x442;&#x43E;&#x447;&#x43D;&#x435; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F; &#x437;&#x43C;&#x456;&#x43D;&#x43D;&#x43E;&#x457; LOCALEDIR &#x43C;&#x43E;&#x436;&#x43D;&#x430; &#x43F;&#x435;&#x440;&#x435;&#x433;&#x43B;&#x44F;&#x43D;&#x443;&#x442;&#x438; &#x437;&#x430; &#x434;&#x43E;&#x43F;&#x43E;&#x43C;&#x43E;&#x433;&#x43E;&#x44E; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x430; <b>--version</b>.</p>
<p>&#x41F;&#x440;&#x438;&#x43A;&#x43B;&#x430;&#x434; (&#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43D;&#x430; &#x43E;&#x431;&#x43E;&#x43B;&#x43E;&#x43D;&#x43A;&#x430; POSIX):</p>
<pre><code> export DOS2UNIX_LOCALEDIR=$HOME/share/locale</code></pre>
</dd>
</dl>
<h1 id="11">&#x41F;&#x41E;&#x412;&#x415;&#x420;&#x41D;&#x423;&#x422;&#x415; &#x417;&#x41D;&#x410;&#x427;&#x415;&#x41D;&#x41D;&#x42F;</h1>
<p>&#x42F;&#x43A;&#x449;&#x43E; &#x437;&#x430;&#x432;&#x434;&#x430;&#x43D;&#x43D;&#x44F; &#x432;&#x434;&#x430;&#x441;&#x442;&#x44C;&#x441;&#x44F; &#x443;&#x441;&#x43F;&#x456;&#x448;&#x43D;&#x43E; &#x432;&#x438;&#x43A;&#x43E;&#x43D;&#x430;&#x442;&#x438;, &#x43F;&#x440;&#x43E;&#x433;&#x440;&#x430;&#x43C;&#x430; &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x435; &#x43D;&#x443;&#x43B;&#x44C;&#x43E;&#x432;&#x438;&#x439; &#x43A;&#x43E;&#x434; &#x432;&#x438;&#x445;&#x43E;&#x434;&#x443;. &#x42F;&#x43A;&#x449;&#x43E; &#x441;&#x442;&#x430;&#x43D;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x441;&#x438;&#x441;&#x442;&#x435;&#x43C;&#x43D;&#x430; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x430;, &#x431;&#x443;&#x434;&#x435; &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x443;&#x442;&#x43E; &#x43A;&#x43E;&#x434; &#x446;&#x456;&#x454;&#x457; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x438;. &#x42F;&#x43A;&#x449;&#x43E; &#x441;&#x442;&#x430;&#x43D;&#x435;&#x442;&#x44C;&#x441;&#x44F; &#x44F;&#x43A;&#x430;&#x441;&#x44C; &#x456;&#x43D;&#x448;&#x430; &#x43F;&#x43E;&#x43C;&#x438;&#x43B;&#x43A;&#x430;, &#x431;&#x443;&#x434;&#x435; &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x443;&#x442;&#x43E; &#x43A;&#x43E;&#x434; 1.</p>
<p>&#x423; &#x440;&#x435;&#x436;&#x438;&#x43C;&#x456; &#x431;&#x435;&#x437; &#x43F;&#x43E;&#x432;&#x456;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x44C; &#x43F;&#x43E;&#x432;&#x435;&#x440;&#x43D;&#x443;&#x442;&#x438;&#x43C; &#x437;&#x43D;&#x430;&#x447;&#x435;&#x43D;&#x43D;&#x44F;&#x43C; &#x437;&#x430;&#x432;&#x436;&#x434;&#x438; &#x431;&#x443;&#x434;&#x435; &#x43D;&#x443;&#x43B;&#x44C;, &#x44F;&#x43A;&#x449;&#x43E; &#x432;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43E; &#x43F;&#x440;&#x430;&#x432;&#x438;&#x43B;&#x44C;&#x43D;&#x456; &#x43F;&#x430;&#x440;&#x430;&#x43C;&#x435;&#x442;&#x440;&#x438; &#x43A;&#x43E;&#x43C;&#x430;&#x43D;&#x434;&#x43D;&#x43E;&#x433;&#x43E; &#x440;&#x44F;&#x434;&#x43A;&#x430;.</p>
<h1 id="12">&#x421;&#x422;&#x410;&#x41D;&#x414;&#x410;&#x420;&#x422;&#x418;</h1>
<p><a href="http://en.wikipedia.org/wiki/Text_file">http://en.wikipedia.org/wiki/Text_file</a></p>
<p><a href="http://uk.wikipedia.org/wiki/Carriage_return">http://uk.wikipedia.org/wiki/Carriage_return</a></p>
<p><a href="http://uk.wikipedia.org/wiki/Newline">http://uk.wikipedia.org/wiki/Newline</a></p>
<p><a href="http://uk.wikipedia.org/wiki/Unicode">http://uk.wikipedia.org/wiki/Unicode</a></p>
<h1 id="13">&#x410;&#x412;&#x422;&#x41E;&#x420;&#x418;</h1>
<p>Benjamin Lin - &lt;blin@socs.uts.edu.au&gt;, Bernd Johannes Wuebben (&#x440;&#x435;&#x436;&#x438;&#x43C; mac2unix) - &lt;wuebben@kde.org&gt;, Christian Wurll (&#x434;&#x43E;&#x434;&#x430;&#x442;&#x43A;&#x43E;&#x432;&#x438;&#x439; &#x43D;&#x43E;&#x432;&#x438;&#x439; &#x440;&#x44F;&#x434;&#x43E;&#x43A;) - &lt;wurll@ira.uka.de&gt;, Erwin Waterlander - &lt;waterlan@xs4all.nl&gt; (&#x441;&#x443;&#x43F;&#x440;&#x43E;&#x432;&#x456;&#x434;&#x43D;&#x438;&#x43A;)</p>
<p>&#x421;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x430; &#x43F;&#x440;&#x43E;&#x435;&#x43A;&#x442;&#x443;: <a href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></p>
<p>&#x421;&#x442;&#x43E;&#x440;&#x456;&#x43D;&#x43A;&#x430; &#x43D;&#x430; SourceForge: <a href="http://sourceforge.net/projects/dos2unix/">http://sourceforge.net/projects/dos2unix/</a></p>
<h1 id="14">&#x422;&#x410;&#x41A;&#x41E;&#x416; &#x41F;&#x415;&#x420;&#x415;&#x413;&#x41B;&#x42F;&#x41D;&#x42C;&#x422;&#x415;</h1>
<p>file(1) find(1) iconv(1) locale(1) xargs(1)</p>
</body>
</html>

View File

@@ -1,666 +0,0 @@
НАЗВА
dos2unix - програма для перетворення даних у текстовому форматі DOS/Mac
у формат Unix, і навпаки
КОРОТКИЙ ОПИС
dos2unix [параметри] [ФАЙЛ ...] [-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
unix2dos [параметри] [ФАЙЛ ...] [-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
ОПИС
До складу пакунка Dos2unix включено програми "dos2unix" та "unix2dos",
призначені для перетворення звичайних текстових даних у форматі DOS або
Mac на дані у форматі Unix, і навпаки.
У текстових файлах DOS/Windows розрив рядка або перехід на новий рядок
здійснюється за допомогою комбінації двох символів: повернення каретки
(CR) і переведення рядка (LF). У текстових файлах Unix за перехід на
новий рядок відповідає один символ: переведення рядка (LF). У текстових
файлах Mac, до Mac OS X, за розрив рядка відповідав один символ:
повернення каретки (CR). У сучасних версіях Mac OS використовується
типовий для Unix розрив рядка (LF).
Окрім символів розриву рядка, програма Dos2unix здатна виконувати
перетворення кодування файлів. Можна перетворити дані у декількох
кодуваннях DOS на файли у кодуванні Latin-1 Unix. Також можна
перетворити дані у файлах Windows Unicode (UTF-16) на дані у кодуванні
Unix Unicode (UTF-8).
Під час перетворення програма пропускатиме двійкові файли, якщо ви не
накажете їй виконати перетворення таких файлів безпосередньо.
Програма автоматично пропускатиме файли, які не є звичайними файлами,
зокрема каталоги та канали FIFO.
Типово, програма не вноситиме змін до символічних посилань та об’єктів
посилань. Якщо потрібно, програма може замінити символічні посилання або
записати перетворені дані до файла-призначення символічного посилання. У
Windows запису до об’єкта символічного посилання не передбачено.
Програму dos2unix було створено за зразком програми dos2unix для
SunOS/Solaris. Втім, існує одна важлива відмінність від оригінальної
версії для SunOS/Solaris. Ця версія типово виконує заміну файлів під час
перетворення (старий режим обробки файлів), а у оригінальній версії для
SunOS/Solaris передбачено підтримку лише парного перетворення (новий
режим обробки файлів). Див. також параметри "-o" та "-n".
ПАРАМЕТРИ
-- Вважати усі наступні параметри назвами файлів. Цим параметром слід
користуватися, якщо вам потрібно виконати перетворення файлів, чиї
назви містять дефіси. Наприклад, щоб виконати перетворення файла
«-foo», скористайтеся такою командою:
dos2unix -- -foo
Або у новому режимі файлів:
dos2unix -n -- -foo out.txt
-ascii
Виконати лише перетворення символів розриву рядків. Типовий режим
перетворення.
-iso
Виконати перетворення з кодування DOS на кодування ISO-8859-1. Див.
розділ щодо режимів перетворення.
-1252
Використати кодову таблицю 1252 Windows (західноєвропейські мови).
-437
Використовувати кодову сторінку DOS 437 (США). Це типова кодова
сторінка для перетворення ISO.
-850
Використовувати кодову сторінку DOS 850 (західноєвропейські мови).
-860
Використовувати сторінку DOS 860 (португальська).
-863
Використовувати сторінку DOS 863 (канадська французька).
-865
Використовувати сторінку DOS 865 (скандинавські мови).
-7 Перетворювати 8-бітові символи на 7-бітові.
-b, --keep-bom
Зберегти позначку порядку байтів (BOM). Якщо у файлі вхідних даних є
BOM, записати BOM до файла результатів. Це типова поведінка під час
перетворення у формат із символами розриву рядків DOS. Див. також
параметр "-r".
-c, --convmode РЕЖИМ
Встановити режим перетворення. Значенням аргументу РЕЖИМ може бути
один з таких рядків: *ascii*, *7bit*, *iso*, *mac*. Типовим є режим
ascii.
-f, --force
Примусове перетворення двійкових файлів.
-gb, --gb18030
У Windows файли в UTF-16 типово перетворюються на файли в UTF-8,
незалежно від встановленої локалі. За допомогою цього параметра ви
можете наказати програмі перетворювати файли в UTF-16 на файли у
GB18030. Цим параметром можна скористатися лише у Windows. Див.
також розділ, присвячений GB18030.
-h, --help
Показати довідкові дані і завершити роботу.
-i[ПРАПОРЦІ], --info[=ПРАПОРЦІ] ФАЙЛ ...
Вивести дані щодо файла. Не виконувати перетворення.
Буде виведено такі дані, у вказаному порядку: кількість розривів
рядків у форматі DOS, кількість розривів рядків у форматі Unix,
кількість розривів рядків у форматі Mac, позначка порядку байтів,
текстовим чи бінарним є файл та назву файла.
Приклад результатів:
6 0 0 no_bom text dos.txt
0 6 0 no_bom text unix.txt
0 0 6 no_bom text mac.txt
6 6 6 no_bom text mixed.txt
50 0 0 UTF-16LE text utf16le.txt
0 50 0 no_bom text utf8unix.txt
50 0 0 UTF-8 text utf8dos.txt
2 418 219 no_bom binary dos2unix.exe
Крім того, можна вказати додаткові прапорці для внесення змін у
виведені дані. Можна використовувати один або декілька таких
прапорців.
d Вивести кількість символів розривів рядка DOS.
u Вивести кількість символів розривів рядка Unix.
m Вивести кількість символів розривів рядка Mac.
b Вивести позначку порядку байтів.
t Вивести дані щодо того, є файл текстовим чи бінарним.
c Вивести дані лише тих файлів, які було б перетворено.
Із прапорцем "c" dos2unix виведе лише назви файлів, у яких
містяться розриви рядків DOS. unix2dos виведе лише назви файлів,
у яких містяться розриви рядків Unix.
Приклади:
Вивести дані щодо усіх файлів *.txt:
dos2unix -i *.txt
Вивести кількість розривів рядків у форматі DOS і розривів рядків у
форматі Unix:
dos2unix -idu *.txt
Вивести лише позначку порядку байтів:
dos2unix --info=b *.txt
Вивести список файлів, у яких є символи розриву рядків DOS:
dos2unix -ic *.txt
Вивести список файлів, у яких використано символи розриву рядків
Unix:
unix2dos -ic *.txt
-k, --keepdate
Зберегти часову позначку файла вхідних даних у файлі результатів
перетворення.
-L, --license
Вивести умови ліцензування програми.
-l, --newline
Вставити додатковий символ розриву рядка.
dos2unix: перетворення на два символи розриву рядків Unix
відбуватиметься лише для комбінацій розриву рядків DOS. У режимі Mac
виконуватиметься перетворення на два розриви рядків Unix лише
символів розриву рядків Mac.
unix2dos: перетворення на дві комбінації розриву рядків DOS
відбуватиметься лише для символів розриву рядків DOS. У режимі Mac
виконуватиметься перетворення на два розриви рядків Mac лише
символів розриву рядків Unix.
-m, --add-bom
Записати до файла результатів позначку порядку байтів (BOM). Типово
буде записано позначку порядку байтів UTF-8.
Якщо дані початкового файла закодовано у UTF-16 і використано
параметр "-u", буде дописано позначку порядку байтів UTF-16.
Не використовуйте цей параметр для кодувань результатів, відмінних
від UTF-8 або UTF-16. Див. також розділ щодо UNICODE.
-n, --newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...
Новий режим обробки файлів. Перетворити дані з файла ВХІДНИЙ_ФАЙЛ і
записати результати до файла ВИХІДНИЙ_ФАЙЛ. Назви файлів слід
вказувати парами, *не слід* використовувати шаблони заміни, інакше
вміст файлів *буде втрачено*.
Власником перетвореного файла буде призначено користувача, яким було
розпочато перетворення у режимі нового файла (парному режимі). Права
доступу на читання або запис нового файла буде визначено на основі
прав доступу до початкового файла мінус umask(1) для користувача,
яким було розпочато перетворення.
-o, --oldfile ФАЙЛ ...
Застарілий режим обробки. Виконати перетворення файла ФАЙЛ і
перезаписати його вміст. Типово, програма працює у цьому режимі.
Можна використовувати шаблони заміни.
У застарілому режимі (режимі заміщення) перетворений файл належатиме
тому самому власнику і групі і матиме ті самі права доступу на
читання або запис, що і початковий файл. Крім того, якщо
перетворення файла виконується іншим користувачем, який має права
доступу на запис до файла (наприклад користувачем root),
перетворення буде перервано, якщо зберегти початкові значення не
вдасться. Зміна власника може означати неможливість читання файла
для його початкового власника. Зміна групи може призвести до проблем
із безпекою, оскільки файл може стати доступним для читання
користувачам, які не повинні мати такі права доступу. Можливість
збереження прав власності та прав доступу до файла передбачено лише
у Unix.
-q, --quiet
Режим без виведення повідомлень. Програма не виводитиме жодних
попереджень або повідомлень про помилки. Повернутим значенням завжди
буде нуль, якщо вказано правильні параметри командного рядка.
-r, --remove-bom
Вилучити позначку порядку байтів (BOM). Не записувати BOM до файла
результатів. Це типова поведінка під час перетворення файлів з
форматом розриву рядків Unix. Див. також параметр "-b".
-s, --safe
Пропускати двійкові файли (типово).
-u, --keep-utf16
Зберегти початкове кодування UTF-16. Файл результатів буде записано
у тому самому кодуванні UTF-16, із прямим або зворотним порядком
байтів, що і початковий файл. Таким чином можна запобігти
перетворенню даних у кодування UTF-8. До файла буде записано
відповідну позначку порядку байтів UTF-16. Вимкнути цей параметр
можна за допомогою параметра "-ascii".
-ul, --assume-utf16le
Припускати, що кодуванням вхідних файлів є UTF-16LE.
Якщо у початковому файлі є позначка порядку байтів (BOM), її буде
використано у файлі-результаті, незалежно від використання цього
параметра.
Якщо вами було зроблено помилкове припущення щодо формату файла
(файл вхідних даних насправді не є файлом у форматі UTF-16LE), і
дані вдасться успішно перетворити, ви отримаєте файл у кодуванні
UTF-8 з помилковим вмістом. Скасувати таке помилкове перетворення
можна за допомогою зворотного перетворення iconv(1) з даних у
форматі UTF-8 на дані у форматі UTF-16LE. Таким чином ви повернетеся
до початкового кодування даних у файлі.
Припущення щодо форматування UTF-16LE працює як визначення *режиму
перетворення*. Перемиканням на типовий режим *ascii* можна вимкнути
припущення щодо форматування UTF-16LE.
-ub, --assume-utf16be
Припускати, що вхідним форматом є UTF-16BE.
Цей параметр працює у спосіб, тотожний до параметра "-ul".
-v, --verbose
Виводити докладні повідомлення. Буде показано додаткові дані щодо
позначок порядку байтів та кількості перетворених символів розриву
рядків.
-F, --follow-symlink
Переходити за символічними посиланням і перетворювати файли, на які
вони вказують.
-R, --replace-symlink
Замінити символічні посилання перетвореними файлами (початкові
файли, на які вони вказують, змінено не буде).
-S, --skip-symlink
Не змінювати символічні посилання та файли, на які вони посилаються
(типово).
-V, --version
Вивести дані щодо версії і завершити роботу.
РЕЖИМ MAC
У звичайному режимі розриви рядків DOS перетворюються на розриви рядків
Unix, і навпаки. Розриви рядків Mac перетворенню не підлягають.
У режимі Mac розриви рядків Mac перетворюються на розриви рядків Unix, і
навпаки. Розриви рядків DOS перетворенню не підлягають.
Щоб запустити програму у режимі перетворення Mac, скористайтеся
параметром командного рядка "-c mac" або програмами "mac2unix" та
"unix2mac".
РЕЖИМИ ПЕРЕТВОРЕННЯ
ascii
У режимі "ascii" виконуватиметься лише перетворення символів розриву
рядків. Цей режим є типовим режимом перетворення.
Хоча цей режим і називається режимом ASCII (стандарту 7-бітового
кодування), насправді кодування символів у ньому є 8-бітовим. Завжди
користуйтеся цим режимом для перетворення файлів у кодуванні UTF-8
(Unicode).
7bit
У цьому режимі усі 8-бітові символи, які не є частиною ASCII, (з
номерами від 128 до 255) буде перетворено на відповідні 7-бітові
символи.
iso Перетворення символів буде виконано з кодування (кодової сторінки)
DOS до кодування ISO-8859-1 (Latin-1) у Unix. Символи DOS, які не
мають еквівалентів у ISO-8859-1 і перетворення яких неможливе, буде
перетворено на символ крапки. Те саме стосується символів
ISO-8859-1, які не мають еквівалентів у DOS.
Якщо буде використано лише параметр "-iso", програма dos2unix
спробує визначити активне кодування. Якщо це виявиться неможливим,
dos2unix використає типове кодування CP437, яке здебільшого
використовується у США. Щоб примусово визначити кодування,
скористайтеся параметром -437 (США), -850 (західноєвропейські мови),
-860 (португальська), -863 (канадська французька) або -865
(скандинавські мови). Використати кодування Windows CP1252
(західноєвропейські мови) можна за допомогою параметра -1252. Для
інших кодувань використовуйте поєднання dos2unix з iconv(1).
Програма iconv здатна виконувати перетворення даних у доволі
широкому спектрі кодувань символів.
Ніколи не користуйтеся перетворенням ISO для текстових файлів у
форматі Unicode. Використання подібного перетворення призведе до
ушкодження вмісту файлів у кодуванні UTF-8.
Декілька прикладів:
Перетворити дані у типовому кодуванні DOS на дані у кодуванні
Latin-1 Unix:
dos2unix -iso -n in.txt out.txt
Перетворити дані у кодуванні DOS CP850 на дані у кодуванні Latin-1
Unix:
dos2unix -850 -n in.txt out.txt
Перетворити дані у кодуванні CP1252 Windows на дані у кодуванні
Latin-1 Unix:
dos2unix -1252 -n in.txt out.txt
Перетворити дані у кодуванні CP252 Windows на дані у кодуванні UTF-8
Unix (Unicode):
iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt
Перетворити дані у кодуванні Latin-1 Unix на дані у типовому
кодуванні DOS:
unix2dos -iso -n in.txt out.txt
Перетворити дані у кодуванні Latin-1 Unix на дані у кодуванні DOS
CP850:
unix2dos -850 -n in.txt out.txt
Перетворити дані у кодуванні Latin-1 Unix на дані у кодуванні
Windows CP1252:
unix2dos -1252 -n in.txt out.txt
Перетворити дані у кодуванні UTF-8 Unix (Unicode) на дані у
кодуванні Windows CP1252:
unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt
Див. також <http://czyborra.com/charsets/codepages.html> та
<http://czyborra.com/charsets/iso8859.html>.
UNICODE
Кодування
Існує декілька різних кодувань Unicode. У Unix та Linux у файлах Unicode
здебільшого використовується кодування UTF-8. У Windows для текстових
файлів Unicode може бути використано кодування UTF-8, UTF-16 або UTF-16
зі зворотним порядком байтів. Втім, здебільшого, використовується формат
UTF-16.
Перетворення
У текстових файлах Unicode, як і у звичайних текстових файлах, може бути
використано розриви рядків DOS, Unix або Mac.
Усі версії dos2unix та unix2dos здатні виконувати перетворення у
кодуванні UTF-8, оскільки UTF-8 було розроблено так, що зворотну
сумісність з ASCII збережено.
Програми dos2unix та unix2dos, зібрані з підтримкою Unicode UTF-16,
можуть читати текстові файли у кодуванні UTF-16 з прямим та зворотним
порядком байтів. Щоб дізнатися про те, чи було dos2unix зібрано з
підтримкою UTF-16, віддайте команду "dos2unix -V".
У Unix/Linux файли у кодуванні UTF-16 перетворюються на файли у
кодуванні локалі. Для визначення поточного кодування символів локалі
скористайтеся командою locale(1). Якщо перетворення виявиться
неможливим, програма повідомить про помилку перетворення і пропустить
відповідний файл.
У Windows файли UTF-16 типово буде перетворено на файли UTF-8. Обидва
типи систем, Windows та Unix/Linux, мають непогані можливості з
підтримки файлів у форматуванні UTF-8.
Кодування UTF-16 та UTF-8 є повністю сумісними. Під час перетворення не
буде втрачено жодної інформації. Якщо під час перетворення даних у
кодуванні UTF-16 на дані у кодуванні UTF-8 трапиться помилка, наприклад,
якщо у вхідному файлі UTF-16 міститиметься якась помилка, файл буде
пропущено.
Якщо використано параметр "-u", файл результатів буде записано у тому
самому кодуванні UTF-16, що і початковий файл. Використання параметра
Option "-u" запобігає перетворенню даних у кодування UTF-8.
У dos2unix та unix2dos не передбачено параметра для перетворення даних у
кодуванні UTF-8 на дані у кодуванні UTF-16.
Режим перетворення ISO та 7-бітовий режим не працюють для файлів UTF-16.
Позначка порядку байтів
У Windows до текстових файлів у кодуванні Unicode типово дописується
позначка порядку байтів (BOM), оскільки багато програм Windows (зокрема
Notepad) додають таку позначку автоматично. Див. також
<http://en.wikipedia.org/wiki/Byte_order_mark>.
У Unix файли у кодуванні Unicode типово не містять позначки порядку
байтів. Вважається, що кодуванням текстових файлів є те кодування, яке
визначається поточною локаллю.
Програма dos2unix може визначити, чи є кодуванням файла UTF-16, лише
якщо у файлі міститься позначка порядку байтів. Якщо у файлі, де
використано кодування UTF-16, немає такої позначки, dos2unix вважатиме
такий файл двійковим (бінарним).
Для перетворення файлів UTF-16 без позначки порядку байтів скористайтеся
параметром "-ul" або "-ub".
Типово dos2unix не записує до файлів результатів перетворення позначки
порядку байтів (BOM). Якщо використано параметр "-b", dos2unix запише до
файла результатів BOM, якщо BOM була у файлі початкових даних.
Типово unix2dos записує позначку порядку байтів (BOM) до файла
результатів, якщо BOM є у початковому файлі. Скористайтеся параметром
"-r", щоб вилучити BOM.
Dos2unix та unix2dos завжди записують до файла результатів позначку
порядку байтів (BOM), якщо використано параметр "-m".
Приклади для Unicode
Перетворити дані з Windows UTF-16 (з позначкою порядку байтів (BOM)) у
формат Unix UTF-8:
dos2unix -n in.txt out.txt
Перетворити дані у форматі Windows UTF-16LE (без BOM) на дані у форматі
UTF-8 Unix:
dos2unix -ul -n in.txt out.txt
Перетворити дані у кодуванні UTF-8 Unix на дані у кодуванні Windows
UTF-8 без BOM:
unix2dos -m -n in.txt out.txt
Перетворити дані у кодуванні UTF-8 Unix на дані у кодуванні Windows
UTF-16:
unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt
GB18030
GB18030 є китайським урядовим стандартом. Підтримка обов’язкової
підмножини стандарту GB18030 є неодмінною вимогою до будь-яких
програмних продуктів, які продаються у Китаї. Див. також
<http://en.wikipedia.org/wiki/GB_18030>.
Кодування GB18030 є повністю сумісним із Unicode. Його можна розглядати
як формат перетворення unicode. Подібно до UTF-8, GB18030 є сумісним із
ASCII. GB18030 також є сумісним із кодовою сторінкою Windows 936, яку ще
називають GBK.
У Unix/Linux файли UTF-16 буде перетворено до кодування GB18030, якщо
кодуванням локалі є GB18030. Зауважте, що це спрацює, лише якщо
встановлено значення країни КНР. Наприклад, у англійській локалі для
Великоританії із встановленою локаллю "en_GB.GB18030" перетворення
UTF-16 на GB18030 не працюватиме, а у китайській локалі "zh_CN.GB18030"
все працюватиме як слід.
У Windows для перетворення файлів UTF-16 на файли GB18030 слід вказати
параметр "-gb".
У файлах у кодуванні GB18030 може міститися позначка порядку байтів, так
само, як у файлах у кодуванні Unicode.
ПРИКЛАДИ
Прочитати вхідні дані зі стандартного джерела (stdin) і записати
результат до стандартного виведення (stdout):
dos2unix
dos2unix -l -c mac
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt
і замістити цей файл:
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii:
dos2unix a.txt
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii.
Перетворити дані у b.txt і замістити цей файл у режимі 7-бітового
перетворення:
dos2unix a.txt -c 7bit b.txt
dos2unix -c ascii a.txt -c 7bit b.txt
dos2unix -ascii a.txt -7 b.txt
Перетворити файл a.txt з формату Mac на формат Unix:
dos2unix -c mac a.txt
mac2unix a.txt
Перетворити файл a.txt з формату Unix на формат Mac:
unix2dos -c mac a.txt
unix2mac a.txt
Перетворити дані у a.txt, замістити цей файл і зберегти часову позначку
початкового файла:
dos2unix -k a.txt
dos2unix -k -o a.txt
Перетворити дані у файлі a.txt і записати результати до файла e.txt:
dos2unix -n a.txt e.txt
Перетворити дані у файлі a.txt і записати результати до файла e.txt.
Скопіювати часову позначку файла a.txt для файла e.txt:
dos2unix -k -n a.txt e.txt
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt
і записати результат до e.txt:
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Перетворити дані у c.txt і записати результати до e.txt. Перетворити
дані у a.txt і замістити ними цей файл. Перетворити дані у b.txt і
замістити ними цей файл. Перетворити дані у d.txt і записати результати
до f.txt:
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ
Для рекурсивного перетворення текстових файлів у ієрархії каталогів слід
використовувати dos2unix у поєднанні з програмами find(1) та xargs(1).
Наприклад, щоб виконати перетворення усіх файлів .txt у структурі
підкаталогів поточного каталогу, віддайте таку команду:
find . -name *.txt |xargs dos2unix
ЛОКАЛІЗАЦІЯ
LANG
Основна мова визначається за допомогою змінної середовища LANG.
Значення змінної LANG складається з декількох частин. Перша частина
записується малими літерами і визначає код мови. Друга частина є
необов’язковою, визначає код країни і записується прописними
літерами, відокремлюється від першої частини символом
підкреслювання. Передбачено також необов’язкову третю частину:
кодування. Ця частина відокремлюється від другої частини крапкою.
Ось декілька прикладів для командних оболонок стандартного типу
POSIX:
export LANG=uk українська
export LANG=uk_UA українська, Україна
export LANG=ru_UA російська, Україна
export LANG=es_ES іспанська, Іспанія
export LANG=es_MX іспанська, Мексика
export LANG=en_US.iso88591 англійська, США, кодування Latin-1
export LANG=en_GB.UTF-8 англійська, Великобританія, кодування UTF-8
Повний список мов та кодів країн наведено у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual-Language
-Codes.html>
У системах Unix для отримання даних щодо локалі можна скористатися
командою locale(1).
LANGUAGE
За допомогою змінної середовища LANGUAGE ви можете вказати список
пріоритеності мов. Записи у списку слід відокремлювати двокрапками.
Програма dos2unix надає перевагу LANGUAGE над LANG. Наприклад, перша
голландська, далі німецька: "LANGUAGE=nl:de". Спочатку вам слід
увімкнути локалізацію, встановивши для змінної LANG (або LC_ALL)
значення, відмінне від «C». Далі ви зможете використовувати список
пріоритетності мов за допомогою змінної LANGUAGE. Додаткові
відомості можна знайти у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-v
ariable.html>
Якщо вами буде вибрано мову, перекладу якою немає, буде показано
стандартні повідомлення англійською мовою.
DOS2UNIX_LOCALEDIR
Змінну LOCALEDIR, встановлену під час збирання програми, можна
змінити за допомогою змінної середовища DOS2UNIX_LOCALEDIR.
LOCALEDIR використовується для пошуку файлів перекладів. Типовим
значенням у системах GNU є "/usr/local/share/locale". Переглянути
поточне значення змінної LOCALEDIR можна переглянути за допомогою
параметра --version.
Приклад (командна оболонка POSIX):
export DOS2UNIX_LOCALEDIR=$HOME/share/locale
ПОВЕРНУТЕ ЗНАЧЕННЯ
Якщо завдання вдасться успішно виконати, програма поверне нульовий код
виходу. Якщо станеться системна помилка, буде повернуто код цієї
помилки. Якщо станеться якась інша помилка, буде повернуто код 1.
У режимі без повідомлень повернутим значенням завжди буде нуль, якщо
вказано правильні параметри командного рядка.
СТАНДАРТИ
<http://en.wikipedia.org/wiki/Text_file>
<http://uk.wikipedia.org/wiki/Carriage_return>
<http://uk.wikipedia.org/wiki/Newline>
<http://uk.wikipedia.org/wiki/Unicode>
АВТОРИ
Benjamin Lin - <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (режим
mac2unix) - <wuebben@kde.org>, Christian Wurll (додатковий новий рядок)
- <wurll@ira.uka.de>, Erwin Waterlander - <waterlan@xs4all.nl>
(супровідник)
Сторінка проекту: <http://waterlan.home.xs4all.nl/dos2unix.html>
Сторінка на SourceForge: <http://sourceforge.net/projects/dos2unix/>
ТАКОЖ ПЕРЕГЛЯНЬТЕ
file(1) find(1) iconv(1) locale(1) xargs(1)

View File

@@ -1,781 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "BEZEICHNUNG"
.IX Header "BEZEICHNUNG"
dos2unix \- Formatumwandlung für Textdateien von DOS/Mac nach Unix und
umgekehrt
.SH "ÜBERSICHT"
.IX Header "ÜBERSICHT"
.Vb 2
\& dos2unix [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
\& unix2dos [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
.Ve
.SH "BESCHREIBUNG"
.IX Header "BESCHREIBUNG"
Das Paket Dos2unix enthält die Werkzeuge \f(CW\*(C`dos2unix\*(C'\fR und \f(CW\*(C`unix2dos\*(C'\fR zum
Umwandeln einfacher Textdateien aus dem \s-1DOS\-\s0 oder Mac-Format in das
Unix-Format und umgekehrt.
.PP
In Textdateien unter DOS/Windows sind Zeilenumbrüche, auch als neue Zeile
(\s-1NL\s0) bekannt, eine Kombination aus zwei Zeichen: einem Wagenrücklauf
(Carriage Return, \s-1CR\s0) gefolgt von einem Zeilenvorschub (Line Feed, \s-1LF\s0). In
Unix-Textdateien bestehen Zeilenumbrüche nur aus einem Zeichen, dem
Zeilenvorschub (\s-1LF\s0). In Mac-Textdateien aus der Zeit vor MacOSX bestand ein
Zeilenumbruch aus einem einzelnen CR-Zeichen. Heute verwendet Mac \s-1OS\s0
Zeilenumbrüche im Unix-Stil (\s-1LF\s0).
.PP
Neben Zeilenumbrüchen kann Dos2unix auch die Zeichenkodierung von Dateien
umwandeln. Einige DOS-Codepages können in Unix Latin\-1 umgewandelt werden,
und Windows-Unicode-Dateien (\s-1UTF\-16\s0) können in Unix-Unicode-Dateien (\s-1UTF\-8\s0)
umgewandelt werden.
.PP
Binärdateien werden automatisch übersprungen, sofern die Umwandlung nicht
erzwungen wird.
.PP
Nicht\-reguläre Dateien, wie Verzeichnisse und \s-1FIFOS \s0(Weiterleitungen) werden
automatisch übersprungen.
.PP
Symbolische Links und deren Ziele werden per Vorgabe unverändert
belassen. Symbolische Links können optional ersetzt werden, oder die Ausgabe
wird in das Ziel des symbolischen Links geschrieben. Unter Windows wird das
Schreiben in das Ziel eines symbolischen Links nicht unterstützt.
.PP
Dos2unix wurde nach dem Vorbild der dos2unix\-Version unter SunOS/Solaris
entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese Version
ersetzt per Vorgabe Dateien bei der Umwandlung (Alte-Datei-Modus), während
unter SunOS/Solaris nur die paarweise Umwandlung (Neue-Datei-Modus)
unterstützt wird. Siehe dazu die Optionen \f(CW\*(C`\-o\*(C'\fR und \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONEN"
.IX Header "OPTIONEN"
.IP "\fB\-\-\fR" 4
.IX Item "--"
nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese Option,
wenn Sie Dateien umwandeln wollen, deren Namen mit einem Minuszeichen
beginnen. Um beispielsweise eine Datei namens »\-bla« umzuwandeln, können Sie
folgenden Befehl verwenden:
.Sp
.Vb 1
\& dos2unix \-\- \-bla
.Ve
.Sp
oder im Neue-Datei-Modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-bla ausgabe.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
wandelt nur Zeilenumbrüche um. Dies ist der vorgegebene Umwandlungsmodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
wandelt aus dem \s-1DOS\-\s0 in den ISO\-8859\-1\-Zeichensatz um. Weitere Informationen
hierzu finden Sie im Abschnitt \s-1UMWANDLUNGSMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
verwendet die Windows-Codepage 1252 (Westeuropäisch).
.IP "\fB\-437\fR" 4
.IX Item "-437"
verwendet die DOS-Codepage 437 (\s-1US\s0). Dies ist die vorgegebene Codepage für
die ISO-Umwandlung.
.IP "\fB\-850\fR" 4
.IX Item "-850"
verwendet die DOS-Codepage 850 (Westeuropäisch).
.IP "\fB\-860\fR" 4
.IX Item "-860"
verwendet die DOS-Codepage 860 (Portugiesisch).
.IP "\fB\-863\fR" 4
.IX Item "-863"
verwendet die DOS-Codepage 863 (Kanadisches Französisch).
.IP "\fB\-865\fR" 4
.IX Item "-865"
verwendet die DOS-Codepage 865 (Skandinavisch).
.IP "\fB\-7\fR" 4
.IX Item "-7"
wandelt 8bit\-Zeichen in ein 7bit\-Bitmuster um.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
erhält die Markierung der Bytereihenfolge (\s-1BOM\s0). Wenn die Eingabedatei eine
\&\s-1BOM\s0 enthält, wird ebenfalls eine \s-1BOM\s0 in die Ausgabedatei geschrieben. Dies
ist das Standardverhalten beim Umwandeln von DOS\-Zeilenumbrüchen. Siehe auch
die Option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1UMWANDLUNGSMODUS\s0\fR" 4
.IX Item "-c, --convmode UMWANDLUNGSMODUS"
legt den Umwandlungsmodus fest. \s-1UMWANDLUNGSMODUS\s0 kann \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR oder \fImac\fR sein, wobei \fIascii\fR die Vorgabe ist.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
erzwingt die Umwandlung von Binärdateien.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
wandelt unter Windows UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 um, ungeachtet
der Einstellung der Locale. Verwenden Sie diese Option zum umwandeln von
Utf\-16\-Dateien in \s-1GB18030.\s0 Diese Option ist nur unter Windows
verfügbar. Siehe auch Abschnitt \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
zeigt eine Hilfe an und beendet das Programm.
.IP "\fB\-i[\s-1SCHALTER\s0], \-\-info[=SCHALTER] \s-1DATEI\s0\fR" 4
.IX Item "-i[SCHALTER], --info[=SCHALTER] DATEI"
zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.
.Sp
Die Ausgabe der Informationen geschieht in der folgenden Reihenfolge: Anzahl
der DOS\-Zeilenumbrüche, Anzahl der Unix\-Zeilenumbrüche, Anzahl der
Mac\-Zeilenumbrüche, Markierung der Bytereihenfolge, Text\- oder Binärformat,
Dateiname.
.Sp
Beispielausgabe:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionale zusätzliche Schalter können gesetzt werden, um die Ausgabe
anzupassen. Einer oder mehrere Schalter können hinzugefügt werden.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
gibt die Anzahl der DOS\-Zeilenumbrüche aus.
.IP "\fBu\fR" 4
.IX Item "u"
gibt die Anzahl der Unix\-Zeilenumbrüche aus.
.IP "\fBm\fR" 4
.IX Item "m"
gibt die Anzahl der Mac\-Zeilenumbrüche aus.
.IP "\fBb\fR" 4
.IX Item "b"
gibt die Markierung der Bytereihenfolge aus.
.IP "\fBt\fR" 4
.IX Item "t"
zeigt an, ob es sich um eine Text\- oder eine Binärdatei handelt.
.IP "\fBc\fR" 4
.IX Item "c"
gibt nur die Dateien aus, die umgewandelt werden würden.
.Sp
Mit dem Schalter \f(CW\*(C`c\*(C'\fR gibt dos2unix nur die Dateien aus, die
DOS\-Zeilenumbrüche enthalten, unix2dos nur die Dateien mit
Unix\-Zeilenumbrüchen.
.RE
.RS 4
.Sp
Beispiele:
.Sp
Informationen zu allen *.txt\-Dateien anzeigen:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Nur die Anzahl der DOS\-Zeilenumbrüche und Unix\-Zeilenumbrüche anzeigen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Nur die Markierung der Bytereihenfolge anzeigen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Die Dateien auflisten, die DOS\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Die Dateien auflisten, die Unix\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
übernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
zeigt die Lizenz des Programms an.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
fügt eine zusätzliche neue Zeile hinzu.
.Sp
\&\fBdos2unix\fR: Nur DOS\-Zeilenumbrüche werden in Unix\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Mac\-Zeilenumbrüche in
Unix\-Zeilenumbrüche umgewandelt.
.Sp
\&\fBunix2dos\fR: Nur Unix\-Zeilenumbrüche werden in DOS\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Unix\-Zeilenumbrüche in
Mac\-Zeilenumbrüche umgewandelt.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
schreibt eine Markierung der Bytereihenfolge (\s-1BOM\s0) in die Ausgabedatei. In
der Voreinstellung wird eine \s-1UTF\-8\-BOM\s0 geschrieben.
.Sp
Wenn die Eingabedatei in \s-1UTF\-16\s0 kodiert ist und die Option \f(CW\*(C`\-u\*(C'\fR verwendet
wird, wird eine \s-1UTF\-16\-BOM\s0 geschrieben.
.Sp
Verwenden Sie diese Option niemals, wenn die Kodierung der Ausgabedatei
weder \s-1UTF\-8\s0 noch \s-1UTF\-16\s0 ist. Weitere Informationen finden Sie im Abschnitt
\&\s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1EINGABEDATEI AUSGABEDATEI\s0 …\fR" 4
.IX Item "-n, --newfile EINGABEDATEI AUSGABEDATEI …"
Neue-Datei-Modus. Die \s-1EINGABEDATEI\s0 wird umgewandelt und in die \s-1AUSGABEDATEI\s0
geschrieben. Die Dateinamen müssen paarweise angegeben werden. Platzhalter
sollten \fInicht\fR verwendet werden, sonst werden Sie Ihre Dateien
\&\fIverlieren\fR.
.Sp
Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird Besitzer
der umgewandelten Datei. Die Lese\- und Schreibrechte werden aus den
Zugriffsrechten der Originaldatei minus der \fIumask\fR\|(1) der Person ermittelt,
die die Umwandlung ausgeführt hat.
.IP "\fB\-o, \-\-oldfile \s-1DATEI\s0 …\fR" 4
.IX Item "-o, --oldfile DATEI …"
Alte-Datei-Modus. Die \s-1DATEI\s0 wird umgewandelt und durch die Ausgabedatei
überschrieben. Per Vorgabe werden Umwandlungen in diesem Modus
ausgeführt. Platzhalter sind verwendbar.
.Sp
Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten Dateien den
gleichen Eigentümer, die gleiche Gruppe und die gleichen Lese\- und
Schreibberechtigungen wie die Originaldatei, auch wenn die Datei von einem
anderen Benutzer umgewandelt wird, der Schreibrechte für die Datei hat (zum
Beispiel der Systemadministrator). Die Umwandlung wird abgebrochen, wenn es
nicht möglich ist, die originalen Werte beizubehalten. Die Änderung des
Eigentümers könnte zum Beispiel bewirken, dass der ursprüngliche Eigentümer
die Datei nicht mehr lesen kann. Die Änderung der Gruppe könnte ein
Sicherheitsrisiko sein, da die Datei vielleicht für Benutzer lesbar wird,
für die sie nicht bestimmt ist. Die Beibehaltung von Eigentümer, Gruppe und
Schreib\- und Leserechten wird nur unter Unix unterstützt.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stiller Modus, in dem alle Warnungen und sonstige Meldungen unterdrückt
werden. Der Rückgabewert ist 0, außer wenn fehlerhafte Befehlszeilenoptionen
angegeben werden.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
entfernt die Markierung der Bytereihenfolge (\s-1BOM\s0). Es wird keine \s-1BOM\s0 in die
Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von
Unix\-Zeilenumbrüchen. Siehe auch die Option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
überspringt Binärdateien (Vorgabe).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
erhält die originale UTF\-16\-Kodierung der Eingabedatei. Die Ausgabedatei
wird in der gleichen UTF\-16\-Kodierung geschrieben (Little\-Endian\- oder
Big-Endian-Bytereihenfolge) wie die Eingabedatei. Dies verhindert die
Umwandlung in \s-1UTF\-8.\s0 Eine \s-1UTF\-16\-BOM\s0 wird dementsprechend geschrieben. Diese
Option kann durch Angabe der Option \f(CW\*(C`\-ascii\*(C'\fR deaktiviert werden.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16LE\s0 hat.
.Sp
Wenn die Eingabedatei eine Markierung der Bytereihenfolge enthält (\s-1BOM\s0),
dann hat die \s-1BOM\s0 Vorrang vor dieser Option.
.Sp
Durch eine falsche Annahme (die Eingabedatei war nicht in \s-1UTF\-16LE\s0 kodiert)
mit erfolgreicher Umwandlung erhalten Sie eine UTF\-8\-Ausgabedatei mit
fehlerhaftem Text. Sie können die fehlgeschlagene Umwandlung mit \fIiconv\fR\|(1)
rückgängig machen, indem Sie die Rückumwandlung von \s-1UTF\-8\s0 nach \s-1UTF\-16LE\s0
vornehmen. Dadurch gewinnen Sie die Originaldatei zurück.
.Sp
Die Annahme von \s-1UTF\-16LE\s0 wirkt wie ein \fIUmwandlungsmodus\fR. Beim Wechsel zum
vorgegebenen \fIascii\fR\-Modus wird die UTF16LE\-Annahme deaktiviert.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16BE\s0 hat.
.Sp
Diese Option ist gleichbedeutend mit \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
zeigt ausführliche Meldungen an. Zusätzliche Informationen werden zu den
Markierungen der Bytereihenfolge (\s-1BOM\s0) und zur Anzahl der umgewandelten
Zeilenumbrüche angezeigt.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
folgt symbolischen Links und wandelt die Zieldateien um.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
ersetzt symbolische Links durch die umgewandelten Dateien (die originalen
Zieldateien bleiben unverändert).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
erhält symbolische Links als solche und lässt die Ziele unverändert
(Vorgabe).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
zeigt Versionsinformationen an und beendet das Programm.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
Im Normalmodus werden Zeilenumbrüche von \s-1DOS\s0 nach Unix und umgekehrt
umgewandelt. Mac\-Zeilenumbrüche werden nicht verändert.
.PP
Im Mac-Modus werden Zeilenumbrüche von Mac nach Unix und umgekehrt
umgewandelt. DOS\-Zeilenumbrüche werden nicht verändert.
.PP
Um das Programm im Mac-Modus auszuführen, verwenden Sie die
Befehlszeilenoption \f(CW\*(C`\-c mac\*(C'\fR oder die Befehle \f(CW\*(C`mac2unix\*(C'\fR oder \f(CW\*(C`unix2mac\*(C'\fR.
.SH "UMWANDLUNGSMODI"
.IX Header "UMWANDLUNGSMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
Im \f(CW\*(C`ascii\*(C'\fR\-Modus werden nur Zeilenumbrüche umgewandelt. Dies ist der
vorgegebene Umwandlungsmodus.
.Sp
Obwohl der Name dieses Modus auf \s-1ASCII\s0 hinweist, welches ein 7\-bit\-Standard
ist, bezieht sich der eigentliche Modus auf 8 Bit. Verwenden Sie diesen
Modus immer dann, wenn Sie Unicode-Dateien in UTF\-8\-Kodierung umwandeln.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das
7\-Bit\-Bitmuster umgewandelt.
.IP "\fBiso\fR" 4
.IX Item "iso"
Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den
ISO-Zeichensatz \s-1ISO\-8859\-1 \s0(Latin\-1) in Unix umgewandelt. DOS-Zeichen ohne
Äquivalent in \s-1ISO\-8859\-1,\s0 für die die Umwandlung nicht möglich ist, werden
durch einen Punkt ersetzt. Gleiches gilt für ISO\-8859\-1\-Zeichen ohne
DOS\-Gegenstück.
.Sp
Wenn nur die Option \f(CW\*(C`\-iso\*(C'\fR angegeben ist, versucht dos2unix die aktive
Codepage selbst zu ermitteln. Sollte dies nicht möglich sein, wird die
Standard-Codepage \s-1CP437\s0 verwendet, welche hauptsächlich in den \s-1USA\s0
eingesetzt wird. Um eine bestimmte Codepage zu erzwingen, verwenden Sie die
Optionen \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Westeuropäisch), \f(CW\*(C`\-860\*(C'\fR (Portugiesisch),
\&\f(CW\*(C`\-863\*(C'\fR (Kanadisches Französisch) oder \f(CW\*(C`\-865\*(C'\fR (Skandinavisch). Die
Windows-Codepage \s-1CP1252 \s0(Westeuropäisch) wird durch die Option \f(CW\*(C`\-1252\*(C'\fR
unterstützt.
.Sp
Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In \s-1UTF\-8\s0
kodierte Dateien werden dadurch beschädigt.
.Sp
Einige Beispiele:
.Sp
Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt ausgabe.txt
.Ve
.Sp
Umwandlung von \s-1DOS CP850\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 eingabe.txt | dos2unix > ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 in die vorgegebene DOS-Codepage:
.Sp
.Vb 1
\& unix2dos \-iso \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix \s-1UTF\-8 \s0(Unicode) nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t CP1252 > ausgabe.txt
.Ve
.Sp
Siehe auch <http://czyborra.com/charsets/codepages.html> und
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Zeichenkodierungen"
.IX Subsection "Zeichenkodierungen"
Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux sind
Unicode-Dateien typischerweise in \s-1UTF\-8\s0 kodiert. Unter Windows können
Textdateien in \s-1UTF\-8, UTF\-16\s0 oder \s-1UTF\-16\s0 in Big-Endian-Bytereihenfolge
kodiert sein, liegen aber meist im Format \s-1UTF\-16\s0 vor.
.SS "Umwandlung"
.IX Subsection "Umwandlung"
Unicode-Textdateien können \s-1DOS\-,\s0 Unix\- oder Mac\-Zeilenumbrüche enthalten, so
wie reguläre Textdateien.
.PP
Alle Versionen von dos2unix und unix2dos können UTF\-8\-kodierte Dateien
umwandeln, weil \s-1UTF\-8\s0 im Hinblick auf Abwärtskompatiblität mit \s-1ASCII\s0
entwickelt wurde.
.PP
Dos2unix und unix2dos mit Unterstützung für \s-1UTF\-16\s0 können in \s-1UTF\-16\s0 kodierte
Dateien in Little\-Endian\- und Big-Endian-Bytereihenfolge lesen. Um
festzustellen, ob dos2unix mit UTF\-16\-Unterstützung kompiliert wurde, geben
Sie \f(CW\*(C`dos2unix \-V\*(C'\fR ein.
.PP
Unter Unix/Linux werden \s-1UTF\-16\s0 kodierte Dateien standardmäßig in die
Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl
\&\fIlocale\fR\|(1) können Sie herausfinden, wie die Zeichenkodierung der Locale
eingestellt ist. Wenn eine Umwandlung nicht möglich ist, verursacht dies
einen Umwandlungsfehler, wodurch die Datei übersprungen wird.
.PP
Unter Windows werden UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 umgewandelt. In
\&\s-1UTF\-8\s0 formatierte Textdateien werden von Windows und Unix/Linux
gleichermaßen unterstützt.
.PP
Die Kodierungen \s-1UTF\-16\s0 und \s-1UTF\-8\s0 sind vollständig kompatibel, daher wird bei
der Umwandlung keinerlei Text verlorengehen. Sollte bei der Umwandlung von
\&\s-1UTF\-16\s0 in \s-1UTF\-8\s0 ein Problem auftreten, beispielsweise wenn die
UTF\-16\-kodierte Eingabedatei einen Fehler enthält, dann wird diese Datei
übersprungen.
.PP
Wenn die Option \f(CW\*(C`\-u\*(C'\fR verwendet wird, wird die Ausgabedatei in der gleichen
UTF\-16\-Kodierung wie die Eingabedatei geschrieben. Die Option \f(CW\*(C`\-u\*(C'\fR
verhindert die Umwandlung in \s-1UTF\-8.\s0
.PP
Dos2unix und unix2dos bieten keine Option zur Umwandlung von UTF\-8\-Dateien
in \s-1UTF\-16.\s0
.PP
Umwandlungen im \s-1ISO\-\s0 und 7bit\-Modus funktionieren mit UTF\-16\-Dateien nicht.
.SS "Markierung der Bytereihenfolge"
.IX Subsection "Markierung der Bytereihenfolge"
Unicode-Textdateien unter Windows haben typischerweise eine Markierung der
Bytereihenfolge (\s-1BOM\s0), da viele Windows-Programme (zum Beispiel Notepad)
solche BOMs standardmäßig hinzufügen. Weitere Informationen hierzu finden
Sie auf <http://de.wikipedia.org/wiki/Byte\-Reihenfolge>.
.PP
Unter Unix haben Textdateien üblicherweise keine \s-1BOM.\s0 Es wird stattdessen
angenommen, dass Textdateien in der Zeichenkodierung entsprechend der
Spracheinstellung vorliegen.
.PP
Dos2unix kann nur dann erkennen, ob eine Datei UTF\-16\-kodiert ist, wenn die
Datei eine \s-1BOM\s0 enthält. Ist dies nicht der Fall, nimmt dos2unix an, dass es
sich um eine Binärdatei handelt.
.PP
Verwenden Sie die Optionen \f(CW\*(C`\-ul\*(C'\fR oder \f(CW\*(C`\-ub\*(C'\fR, um eine UTF\-16\-Datei ohne \s-1BOM\s0
umzuwandeln.
.PP
Dos2unix schreibt in der Voreinstellung keine \s-1BOM\s0 in die Ausgabedatei. Mit
der Option \f(CW\*(C`\-b\*(C'\fR schreibt Dos2unix eine \s-1BOM,\s0 wenn die Eingabedatei ebenfalls
eine \s-1BOM\s0 hat.
.PP
Unix2dos schreibt in der Voreinstellung eine \s-1BOM\s0 in die Ausgabedatei, wenn
die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden Sie die
Option \f(CW\*(C`\-r\*(C'\fR, um die \s-1BOM\s0 zu entfernen.
.PP
Dos2unix und unix2dos schreiben immer eine \s-1BOM,\s0 wenn die Option \f(CW\*(C`\-m\*(C'\fR
angegeben ist.
.SS "Unicode-Beispiele"
.IX Subsection "Unicode-Beispiele"
Umwandlung von Windows \s-1UTF\-16 \s0(mit \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Windows \s-1UTF\-16LE \s0(ohne \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-8\s0 mit \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t UTF\-16 > ausgabe.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 ist ein Standard der chinesischen Regierung. Eine Teilmenge des in
\&\s-1GB18030\s0 definierten Standards ist offiziell für alle in China verkauften
Softwareprodukte vorgeschrieben. Siehe auch
<http://de.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 ist vollständig zu Unicode kompatibel und kann als
Unicode-Umwandlungsformat betrahctet werden. Wie auch \s-1UTF\-8\s0 ist \s-1GB18030\s0
kompatibel zu \s-1ASCII.\s0 Ebenfalls kompatibel ist es zur Codepage 936 von
Windows, auch als \s-1GBK\s0 bekannt.
.PP
Unter Unix/Linux werden UTF\-16\-Dateien in \s-1GB18030\s0 umgewandelt, wenn die
Einstellung der Locale auf \s-1GB18030\s0 gesetzt ist. Beachten Sie, dass dies nur
funktioniert, wenn der Ort auf »China« gesetzt ist. Zum Beispiel wird in
einer Locale-Einstellung \f(CW\*(C`en_GB.GB18030\*(C'\fR (Britisches Englisch) die
Umwandlung von \s-1UTF\-16\s0 in \s-1GB18030\s0 nicht möglich sein, aber in der
chinesischen Einstellung \f(CW\*(C`zh_CN.GB18030\*(C'\fR dagegen funktionieren.
.PP
Unter Windows benötigen Sie die Option \f(CW\*(C`\-gb\*(C'\fR, um UTF\-16\-Dateien in \s-1GB18030\s0
umwandeln zu können.
.PP
In \s-1GB 18030\s0 kodierte Dateien haben wie Unicode-Dateien eine Markierung der
Bytereihenfolge (\s-1BOM\s0).
.SH "BEISPIELE"
.IX Header "BEISPIELE"
Aus der Standardeingabe lesen und in die Standardausgabe schreiben:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit\-Modus umwandeln
und ersetzen:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
a.txt aus dem Mac\- in das Unix-Format umwandeln:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
a.txt aus dem Unix\- in das Mac-Format umwandeln:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
a.txt unter Beibehaltung des ursprünglichen Zeitstempels umwandeln:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den
gleichen Zeitstempel erhält wie a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach e.txt
schreiben:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln und
ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das Ergebnis
nach f.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "REKURSIVE UMWANDLUNG"
.IX Header "REKURSIVE UMWANDLUNG"
Verwenden Sie dos2unix zusammen mit den Befehlen \fIfind\fR\|(1) und \fIxargs\fR\|(1), um
Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um beispielsweise
alle *.txt\-Dateien im aktuellen Verzeichnis und dessen Unterverzeichnissen
umzuwandeln, geben Sie Folgendes ein:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISIERUNG"
.IX Header "LOKALISIERUNG"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Die primäre Sprache wird durch die Umgebungsvariable \s-1LANG\s0 festgelegt. Diese
Variable besteht aus mehreren Teilen: Der erste Teil besteht aus zwei
Kleinbuchstaben, die den Sprachcode angeben. Der zweite Teil ist optional
und bezeichnet den Ländercode in Großbuchstaben, vom davor stehenden
Sprachcode durch einen Unterstrich getrennt. Der dritte Teil ist ebenfalls
optional und gibt die Zeichenkodierung an, vom Ländercode durch einen Punkt
getrennt. Einige Beispiele für Standard-POSIX-Shells:
.Sp
.Vb 7
\& export LANG=de Deutsch
\& export LANG=de_DE Deutsch, Deutschland
\& export LANG=de_AT Deutsch, Österreich
\& export LANG=es_ES Spanisch, Spanien
\& export LANG=es_MX Spanisch, Mexiko
\& export LANG=en_US.iso88591 Englisch, USA, Latin\-1\-Zeichenkodierung
\& export LANG=en_GB.UTF\-8 Englisch, GB, UTF\-8\-Zeichenkodierung
.Ve
.Sp
Eine vollständige Liste der Sprachen und Ländercodes finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Auf Unix-Systemen erhalten Sie mit dem Befehl \fIlocale\fR\|(1) spezifische
Informationen zu den Spracheinstellungen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Mit der Umgebungsvariable \s-1LANGUAGE\s0 können Sie eine Prioritätenliste für
Sprachen übergeben, die Sie durch Doppelpunkte voneinander trennen. Dos2unix
gibt \s-1LANGUAGE\s0 vor \s-1LANG\s0 den Vorzug, zum Beispiel bei Deutsch vor
Niederländisch: \f(CW\*(C`LANGUAGE=de:nl\*(C'\fR. Sie müssen zunächst die Lokalisierung
aktivieren, indem Sie die Variable \s-1LANG \s0(oder \s-1LC_ALL\s0) auf einen anderen Wert
als »C« setzen, bevor Sie die Liste der Sprachprioritäten mit der Variable
\&\s-1LANGUAGE\s0 nutzen können. Weitere Informationen finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Falls Sie eine Sprache auswählen, die nicht verfügbar ist, erhalten Sie die
Standardmeldungen in englischer Sprache.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Durch die Umgebungsvariable \s-1DOS2UNIX_LOCALEDIR\s0 wird \s-1LOCALEDIR\s0 während der
Kompilierung übergangen. \s-1LOCALEDIR\s0 wird verwendet, um Sprachdateien zu
finden. Der GNU-Standardwert ist \f(CW\*(C`/usr/local/share/locale\*(C'\fR. Die Option
\&\fB\-\-version\fR zeigt das verwendete \s-1LOCALEDIR\s0 an.
.Sp
Beispiel (POSIX-Shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RÜCKGABEWERT"
.IX Header "RÜCKGABEWERT"
Bei Erfolg wird 0 zurückgegeben. Bei aufgetretenen Systemfehlern wird der
letzte Systemfehler zurückgegeben. Für alle anderen Fehler wird 1
zurückgegeben.
.PP
Der Rückgabewert ist im stillen Modus stets 0, außer wenn fehlerhafte
Befehlszeilenoptionen verwendet werden.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://de.wikipedia.org/wiki/Textdatei>
.PP
<http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf>
.PP
<http://de.wikipedia.org/wiki/Zeilenumbruch>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTOREN"
.IX Header "AUTOREN"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(Mac2unix\-Modus) \- <wuebben@kde.org>, Christian Wurll (Extra Zeilenumbruch)
\&\- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (Betreuer)
.PP
Projektseite: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-Seite: <http://sourceforge.net/projects/dos2unix/>
.SH "SIEHE AUCH"
.IX Header "SIEHE AUCH"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,781 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "BEZEICHNUNG"
.IX Header "BEZEICHNUNG"
dos2unix \- Formatumwandlung für Textdateien von DOS/Mac nach Unix und
umgekehrt
.SH "ÜBERSICHT"
.IX Header "ÜBERSICHT"
.Vb 2
\& dos2unix [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
\& unix2dos [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
.Ve
.SH "BESCHREIBUNG"
.IX Header "BESCHREIBUNG"
Das Paket Dos2unix enthält die Werkzeuge \f(CW\*(C`dos2unix\*(C'\fR und \f(CW\*(C`unix2dos\*(C'\fR zum
Umwandeln einfacher Textdateien aus dem \s-1DOS\-\s0 oder Mac-Format in das
Unix-Format und umgekehrt.
.PP
In Textdateien unter DOS/Windows sind Zeilenumbrüche, auch als neue Zeile
(\s-1NL\s0) bekannt, eine Kombination aus zwei Zeichen: einem Wagenrücklauf
(Carriage Return, \s-1CR\s0) gefolgt von einem Zeilenvorschub (Line Feed, \s-1LF\s0). In
Unix-Textdateien bestehen Zeilenumbrüche nur aus einem Zeichen, dem
Zeilenvorschub (\s-1LF\s0). In Mac-Textdateien aus der Zeit vor MacOSX bestand ein
Zeilenumbruch aus einem einzelnen CR-Zeichen. Heute verwendet Mac \s-1OS\s0
Zeilenumbrüche im Unix-Stil (\s-1LF\s0).
.PP
Neben Zeilenumbrüchen kann Dos2unix auch die Zeichenkodierung von Dateien
umwandeln. Einige DOS-Codepages können in Unix Latin\-1 umgewandelt werden,
und Windows-Unicode-Dateien (\s-1UTF\-16\s0) können in Unix-Unicode-Dateien (\s-1UTF\-8\s0)
umgewandelt werden.
.PP
Binärdateien werden automatisch übersprungen, sofern die Umwandlung nicht
erzwungen wird.
.PP
Nicht\-reguläre Dateien, wie Verzeichnisse und \s-1FIFOS \s0(Weiterleitungen) werden
automatisch übersprungen.
.PP
Symbolische Links und deren Ziele werden per Vorgabe unverändert
belassen. Symbolische Links können optional ersetzt werden, oder die Ausgabe
wird in das Ziel des symbolischen Links geschrieben. Unter Windows wird das
Schreiben in das Ziel eines symbolischen Links nicht unterstützt.
.PP
Dos2unix wurde nach dem Vorbild der dos2unix\-Version unter SunOS/Solaris
entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese Version
ersetzt per Vorgabe Dateien bei der Umwandlung (Alte-Datei-Modus), während
unter SunOS/Solaris nur die paarweise Umwandlung (Neue-Datei-Modus)
unterstützt wird. Siehe dazu die Optionen \f(CW\*(C`\-o\*(C'\fR und \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONEN"
.IX Header "OPTIONEN"
.IP "\fB\-\-\fR" 4
.IX Item "--"
nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese Option,
wenn Sie Dateien umwandeln wollen, deren Namen mit einem Minuszeichen
beginnen. Um beispielsweise eine Datei namens »\-bla« umzuwandeln, können Sie
folgenden Befehl verwenden:
.Sp
.Vb 1
\& dos2unix \-\- \-bla
.Ve
.Sp
oder im Neue-Datei-Modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-bla ausgabe.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
wandelt nur Zeilenumbrüche um. Dies ist der vorgegebene Umwandlungsmodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
wandelt aus dem \s-1DOS\-\s0 in den ISO\-8859\-1\-Zeichensatz um. Weitere Informationen
hierzu finden Sie im Abschnitt \s-1UMWANDLUNGSMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
verwendet die Windows-Codepage 1252 (Westeuropäisch).
.IP "\fB\-437\fR" 4
.IX Item "-437"
verwendet die DOS-Codepage 437 (\s-1US\s0). Dies ist die vorgegebene Codepage für
die ISO-Umwandlung.
.IP "\fB\-850\fR" 4
.IX Item "-850"
verwendet die DOS-Codepage 850 (Westeuropäisch).
.IP "\fB\-860\fR" 4
.IX Item "-860"
verwendet die DOS-Codepage 860 (Portugiesisch).
.IP "\fB\-863\fR" 4
.IX Item "-863"
verwendet die DOS-Codepage 863 (Kanadisches Französisch).
.IP "\fB\-865\fR" 4
.IX Item "-865"
verwendet die DOS-Codepage 865 (Skandinavisch).
.IP "\fB\-7\fR" 4
.IX Item "-7"
wandelt 8bit\-Zeichen in ein 7bit\-Bitmuster um.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
erhält die Markierung der Bytereihenfolge (\s-1BOM\s0). Wenn die Eingabedatei eine
\&\s-1BOM\s0 enthält, wird ebenfalls eine \s-1BOM\s0 in die Ausgabedatei geschrieben. Dies
ist das Standardverhalten beim Umwandeln von DOS\-Zeilenumbrüchen. Siehe auch
die Option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1UMWANDLUNGSMODUS\s0\fR" 4
.IX Item "-c, --convmode UMWANDLUNGSMODUS"
legt den Umwandlungsmodus fest. \s-1UMWANDLUNGSMODUS\s0 kann \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR oder \fImac\fR sein, wobei \fIascii\fR die Vorgabe ist.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
erzwingt die Umwandlung von Binärdateien.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
wandelt unter Windows UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 um, ungeachtet
der Einstellung der Locale. Verwenden Sie diese Option zum umwandeln von
Utf\-16\-Dateien in \s-1GB18030.\s0 Diese Option ist nur unter Windows
verfügbar. Siehe auch Abschnitt \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
zeigt eine Hilfe an und beendet das Programm.
.IP "\fB\-i[\s-1SCHALTER\s0], \-\-info[=SCHALTER] \s-1DATEI\s0\fR" 4
.IX Item "-i[SCHALTER], --info[=SCHALTER] DATEI"
zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.
.Sp
Die Ausgabe der Informationen geschieht in der folgenden Reihenfolge: Anzahl
der DOS\-Zeilenumbrüche, Anzahl der Unix\-Zeilenumbrüche, Anzahl der
Mac\-Zeilenumbrüche, Markierung der Bytereihenfolge, Text\- oder Binärformat,
Dateiname.
.Sp
Beispielausgabe:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionale zusätzliche Schalter können gesetzt werden, um die Ausgabe
anzupassen. Einer oder mehrere Schalter können hinzugefügt werden.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
gibt die Anzahl der DOS\-Zeilenumbrüche aus.
.IP "\fBu\fR" 4
.IX Item "u"
gibt die Anzahl der Unix\-Zeilenumbrüche aus.
.IP "\fBm\fR" 4
.IX Item "m"
gibt die Anzahl der Mac\-Zeilenumbrüche aus.
.IP "\fBb\fR" 4
.IX Item "b"
gibt die Markierung der Bytereihenfolge aus.
.IP "\fBt\fR" 4
.IX Item "t"
zeigt an, ob es sich um eine Text\- oder eine Binärdatei handelt.
.IP "\fBc\fR" 4
.IX Item "c"
gibt nur die Dateien aus, die umgewandelt werden würden.
.Sp
Mit dem Schalter \f(CW\*(C`c\*(C'\fR gibt dos2unix nur die Dateien aus, die
DOS\-Zeilenumbrüche enthalten, unix2dos nur die Dateien mit
Unix\-Zeilenumbrüchen.
.RE
.RS 4
.Sp
Beispiele:
.Sp
Informationen zu allen *.txt\-Dateien anzeigen:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Nur die Anzahl der DOS\-Zeilenumbrüche und Unix\-Zeilenumbrüche anzeigen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Nur die Markierung der Bytereihenfolge anzeigen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Die Dateien auflisten, die DOS\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Die Dateien auflisten, die Unix\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
übernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
zeigt die Lizenz des Programms an.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
fügt eine zusätzliche neue Zeile hinzu.
.Sp
\&\fBdos2unix\fR: Nur DOS\-Zeilenumbrüche werden in Unix\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Mac\-Zeilenumbrüche in
Unix\-Zeilenumbrüche umgewandelt.
.Sp
\&\fBunix2dos\fR: Nur Unix\-Zeilenumbrüche werden in DOS\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Unix\-Zeilenumbrüche in
Mac\-Zeilenumbrüche umgewandelt.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
schreibt eine Markierung der Bytereihenfolge (\s-1BOM\s0) in die Ausgabedatei. In
der Voreinstellung wird eine \s-1UTF\-8\-BOM\s0 geschrieben.
.Sp
Wenn die Eingabedatei in \s-1UTF\-16\s0 kodiert ist und die Option \f(CW\*(C`\-u\*(C'\fR verwendet
wird, wird eine \s-1UTF\-16\-BOM\s0 geschrieben.
.Sp
Verwenden Sie diese Option niemals, wenn die Kodierung der Ausgabedatei
weder \s-1UTF\-8\s0 noch \s-1UTF\-16\s0 ist. Weitere Informationen finden Sie im Abschnitt
\&\s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1EINGABEDATEI AUSGABEDATEI\s0 …\fR" 4
.IX Item "-n, --newfile EINGABEDATEI AUSGABEDATEI …"
Neue-Datei-Modus. Die \s-1EINGABEDATEI\s0 wird umgewandelt und in die \s-1AUSGABEDATEI\s0
geschrieben. Die Dateinamen müssen paarweise angegeben werden. Platzhalter
sollten \fInicht\fR verwendet werden, sonst werden Sie Ihre Dateien
\&\fIverlieren\fR.
.Sp
Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird Besitzer
der umgewandelten Datei. Die Lese\- und Schreibrechte werden aus den
Zugriffsrechten der Originaldatei minus der \fIumask\fR\|(1) der Person ermittelt,
die die Umwandlung ausgeführt hat.
.IP "\fB\-o, \-\-oldfile \s-1DATEI\s0 …\fR" 4
.IX Item "-o, --oldfile DATEI …"
Alte-Datei-Modus. Die \s-1DATEI\s0 wird umgewandelt und durch die Ausgabedatei
überschrieben. Per Vorgabe werden Umwandlungen in diesem Modus
ausgeführt. Platzhalter sind verwendbar.
.Sp
Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten Dateien den
gleichen Eigentümer, die gleiche Gruppe und die gleichen Lese\- und
Schreibberechtigungen wie die Originaldatei, auch wenn die Datei von einem
anderen Benutzer umgewandelt wird, der Schreibrechte für die Datei hat (zum
Beispiel der Systemadministrator). Die Umwandlung wird abgebrochen, wenn es
nicht möglich ist, die originalen Werte beizubehalten. Die Änderung des
Eigentümers könnte zum Beispiel bewirken, dass der ursprüngliche Eigentümer
die Datei nicht mehr lesen kann. Die Änderung der Gruppe könnte ein
Sicherheitsrisiko sein, da die Datei vielleicht für Benutzer lesbar wird,
für die sie nicht bestimmt ist. Die Beibehaltung von Eigentümer, Gruppe und
Schreib\- und Leserechten wird nur unter Unix unterstützt.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stiller Modus, in dem alle Warnungen und sonstige Meldungen unterdrückt
werden. Der Rückgabewert ist 0, außer wenn fehlerhafte Befehlszeilenoptionen
angegeben werden.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
entfernt die Markierung der Bytereihenfolge (\s-1BOM\s0). Es wird keine \s-1BOM\s0 in die
Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von
Unix\-Zeilenumbrüchen. Siehe auch die Option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
überspringt Binärdateien (Vorgabe).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
erhält die originale UTF\-16\-Kodierung der Eingabedatei. Die Ausgabedatei
wird in der gleichen UTF\-16\-Kodierung geschrieben (Little\-Endian\- oder
Big-Endian-Bytereihenfolge) wie die Eingabedatei. Dies verhindert die
Umwandlung in \s-1UTF\-8.\s0 Eine \s-1UTF\-16\-BOM\s0 wird dementsprechend geschrieben. Diese
Option kann durch Angabe der Option \f(CW\*(C`\-ascii\*(C'\fR deaktiviert werden.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16LE\s0 hat.
.Sp
Wenn die Eingabedatei eine Markierung der Bytereihenfolge enthält (\s-1BOM\s0),
dann hat die \s-1BOM\s0 Vorrang vor dieser Option.
.Sp
Durch eine falsche Annahme (die Eingabedatei war nicht in \s-1UTF\-16LE\s0 kodiert)
mit erfolgreicher Umwandlung erhalten Sie eine UTF\-8\-Ausgabedatei mit
fehlerhaftem Text. Sie können die fehlgeschlagene Umwandlung mit \fIiconv\fR\|(1)
rückgängig machen, indem Sie die Rückumwandlung von \s-1UTF\-8\s0 nach \s-1UTF\-16LE\s0
vornehmen. Dadurch gewinnen Sie die Originaldatei zurück.
.Sp
Die Annahme von \s-1UTF\-16LE\s0 wirkt wie ein \fIUmwandlungsmodus\fR. Beim Wechsel zum
vorgegebenen \fIascii\fR\-Modus wird die UTF16LE\-Annahme deaktiviert.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16BE\s0 hat.
.Sp
Diese Option ist gleichbedeutend mit \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
zeigt ausführliche Meldungen an. Zusätzliche Informationen werden zu den
Markierungen der Bytereihenfolge (\s-1BOM\s0) und zur Anzahl der umgewandelten
Zeilenumbrüche angezeigt.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
folgt symbolischen Links und wandelt die Zieldateien um.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
ersetzt symbolische Links durch die umgewandelten Dateien (die originalen
Zieldateien bleiben unverändert).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
erhält symbolische Links als solche und lässt die Ziele unverändert
(Vorgabe).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
zeigt Versionsinformationen an und beendet das Programm.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
Im Normalmodus werden Zeilenumbrüche von \s-1DOS\s0 nach Unix und umgekehrt
umgewandelt. Mac\-Zeilenumbrüche werden nicht verändert.
.PP
Im Mac-Modus werden Zeilenumbrüche von Mac nach Unix und umgekehrt
umgewandelt. DOS\-Zeilenumbrüche werden nicht verändert.
.PP
Um das Programm im Mac-Modus auszuführen, verwenden Sie die
Befehlszeilenoption \f(CW\*(C`\-c mac\*(C'\fR oder die Befehle \f(CW\*(C`mac2unix\*(C'\fR oder \f(CW\*(C`unix2mac\*(C'\fR.
.SH "UMWANDLUNGSMODI"
.IX Header "UMWANDLUNGSMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
Im \f(CW\*(C`ascii\*(C'\fR\-Modus werden nur Zeilenumbrüche umgewandelt. Dies ist der
vorgegebene Umwandlungsmodus.
.Sp
Obwohl der Name dieses Modus auf \s-1ASCII\s0 hinweist, welches ein 7\-bit\-Standard
ist, bezieht sich der eigentliche Modus auf 8 Bit. Verwenden Sie diesen
Modus immer dann, wenn Sie Unicode-Dateien in UTF\-8\-Kodierung umwandeln.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das
7\-Bit\-Bitmuster umgewandelt.
.IP "\fBiso\fR" 4
.IX Item "iso"
Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den
ISO-Zeichensatz \s-1ISO\-8859\-1 \s0(Latin\-1) in Unix umgewandelt. DOS-Zeichen ohne
Äquivalent in \s-1ISO\-8859\-1,\s0 für die die Umwandlung nicht möglich ist, werden
durch einen Punkt ersetzt. Gleiches gilt für ISO\-8859\-1\-Zeichen ohne
DOS\-Gegenstück.
.Sp
Wenn nur die Option \f(CW\*(C`\-iso\*(C'\fR angegeben ist, versucht dos2unix die aktive
Codepage selbst zu ermitteln. Sollte dies nicht möglich sein, wird die
Standard-Codepage \s-1CP437\s0 verwendet, welche hauptsächlich in den \s-1USA\s0
eingesetzt wird. Um eine bestimmte Codepage zu erzwingen, verwenden Sie die
Optionen \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Westeuropäisch), \f(CW\*(C`\-860\*(C'\fR (Portugiesisch),
\&\f(CW\*(C`\-863\*(C'\fR (Kanadisches Französisch) oder \f(CW\*(C`\-865\*(C'\fR (Skandinavisch). Die
Windows-Codepage \s-1CP1252 \s0(Westeuropäisch) wird durch die Option \f(CW\*(C`\-1252\*(C'\fR
unterstützt.
.Sp
Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In \s-1UTF\-8\s0
kodierte Dateien werden dadurch beschädigt.
.Sp
Einige Beispiele:
.Sp
Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt ausgabe.txt
.Ve
.Sp
Umwandlung von \s-1DOS CP850\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 eingabe.txt | dos2unix > ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 in die vorgegebene DOS-Codepage:
.Sp
.Vb 1
\& unix2dos \-iso \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix \s-1UTF\-8 \s0(Unicode) nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t CP1252 > ausgabe.txt
.Ve
.Sp
Siehe auch <http://czyborra.com/charsets/codepages.html> und
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Zeichenkodierungen"
.IX Subsection "Zeichenkodierungen"
Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux sind
Unicode-Dateien typischerweise in \s-1UTF\-8\s0 kodiert. Unter Windows können
Textdateien in \s-1UTF\-8, UTF\-16\s0 oder \s-1UTF\-16\s0 in Big-Endian-Bytereihenfolge
kodiert sein, liegen aber meist im Format \s-1UTF\-16\s0 vor.
.SS "Umwandlung"
.IX Subsection "Umwandlung"
Unicode-Textdateien können \s-1DOS\-,\s0 Unix\- oder Mac\-Zeilenumbrüche enthalten, so
wie reguläre Textdateien.
.PP
Alle Versionen von dos2unix und unix2dos können UTF\-8\-kodierte Dateien
umwandeln, weil \s-1UTF\-8\s0 im Hinblick auf Abwärtskompatiblität mit \s-1ASCII\s0
entwickelt wurde.
.PP
Dos2unix und unix2dos mit Unterstützung für \s-1UTF\-16\s0 können in \s-1UTF\-16\s0 kodierte
Dateien in Little\-Endian\- und Big-Endian-Bytereihenfolge lesen. Um
festzustellen, ob dos2unix mit UTF\-16\-Unterstützung kompiliert wurde, geben
Sie \f(CW\*(C`dos2unix \-V\*(C'\fR ein.
.PP
Unter Unix/Linux werden \s-1UTF\-16\s0 kodierte Dateien standardmäßig in die
Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl
\&\fIlocale\fR\|(1) können Sie herausfinden, wie die Zeichenkodierung der Locale
eingestellt ist. Wenn eine Umwandlung nicht möglich ist, verursacht dies
einen Umwandlungsfehler, wodurch die Datei übersprungen wird.
.PP
Unter Windows werden UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 umgewandelt. In
\&\s-1UTF\-8\s0 formatierte Textdateien werden von Windows und Unix/Linux
gleichermaßen unterstützt.
.PP
Die Kodierungen \s-1UTF\-16\s0 und \s-1UTF\-8\s0 sind vollständig kompatibel, daher wird bei
der Umwandlung keinerlei Text verlorengehen. Sollte bei der Umwandlung von
\&\s-1UTF\-16\s0 in \s-1UTF\-8\s0 ein Problem auftreten, beispielsweise wenn die
UTF\-16\-kodierte Eingabedatei einen Fehler enthält, dann wird diese Datei
übersprungen.
.PP
Wenn die Option \f(CW\*(C`\-u\*(C'\fR verwendet wird, wird die Ausgabedatei in der gleichen
UTF\-16\-Kodierung wie die Eingabedatei geschrieben. Die Option \f(CW\*(C`\-u\*(C'\fR
verhindert die Umwandlung in \s-1UTF\-8.\s0
.PP
Dos2unix und unix2dos bieten keine Option zur Umwandlung von UTF\-8\-Dateien
in \s-1UTF\-16.\s0
.PP
Umwandlungen im \s-1ISO\-\s0 und 7bit\-Modus funktionieren mit UTF\-16\-Dateien nicht.
.SS "Markierung der Bytereihenfolge"
.IX Subsection "Markierung der Bytereihenfolge"
Unicode-Textdateien unter Windows haben typischerweise eine Markierung der
Bytereihenfolge (\s-1BOM\s0), da viele Windows-Programme (zum Beispiel Notepad)
solche BOMs standardmäßig hinzufügen. Weitere Informationen hierzu finden
Sie auf <http://de.wikipedia.org/wiki/Byte\-Reihenfolge>.
.PP
Unter Unix haben Textdateien üblicherweise keine \s-1BOM.\s0 Es wird stattdessen
angenommen, dass Textdateien in der Zeichenkodierung entsprechend der
Spracheinstellung vorliegen.
.PP
Dos2unix kann nur dann erkennen, ob eine Datei UTF\-16\-kodiert ist, wenn die
Datei eine \s-1BOM\s0 enthält. Ist dies nicht der Fall, nimmt dos2unix an, dass es
sich um eine Binärdatei handelt.
.PP
Verwenden Sie die Optionen \f(CW\*(C`\-ul\*(C'\fR oder \f(CW\*(C`\-ub\*(C'\fR, um eine UTF\-16\-Datei ohne \s-1BOM\s0
umzuwandeln.
.PP
Dos2unix schreibt in der Voreinstellung keine \s-1BOM\s0 in die Ausgabedatei. Mit
der Option \f(CW\*(C`\-b\*(C'\fR schreibt Dos2unix eine \s-1BOM,\s0 wenn die Eingabedatei ebenfalls
eine \s-1BOM\s0 hat.
.PP
Unix2dos schreibt in der Voreinstellung eine \s-1BOM\s0 in die Ausgabedatei, wenn
die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden Sie die
Option \f(CW\*(C`\-r\*(C'\fR, um die \s-1BOM\s0 zu entfernen.
.PP
Dos2unix und unix2dos schreiben immer eine \s-1BOM,\s0 wenn die Option \f(CW\*(C`\-m\*(C'\fR
angegeben ist.
.SS "Unicode-Beispiele"
.IX Subsection "Unicode-Beispiele"
Umwandlung von Windows \s-1UTF\-16 \s0(mit \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Windows \s-1UTF\-16LE \s0(ohne \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-8\s0 mit \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t UTF\-16 > ausgabe.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 ist ein Standard der chinesischen Regierung. Eine Teilmenge des in
\&\s-1GB18030\s0 definierten Standards ist offiziell für alle in China verkauften
Softwareprodukte vorgeschrieben. Siehe auch
<http://de.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 ist vollständig zu Unicode kompatibel und kann als
Unicode-Umwandlungsformat betrahctet werden. Wie auch \s-1UTF\-8\s0 ist \s-1GB18030\s0
kompatibel zu \s-1ASCII.\s0 Ebenfalls kompatibel ist es zur Codepage 936 von
Windows, auch als \s-1GBK\s0 bekannt.
.PP
Unter Unix/Linux werden UTF\-16\-Dateien in \s-1GB18030\s0 umgewandelt, wenn die
Einstellung der Locale auf \s-1GB18030\s0 gesetzt ist. Beachten Sie, dass dies nur
funktioniert, wenn der Ort auf »China« gesetzt ist. Zum Beispiel wird in
einer Locale-Einstellung \f(CW\*(C`en_GB.GB18030\*(C'\fR (Britisches Englisch) die
Umwandlung von \s-1UTF\-16\s0 in \s-1GB18030\s0 nicht möglich sein, aber in der
chinesischen Einstellung \f(CW\*(C`zh_CN.GB18030\*(C'\fR dagegen funktionieren.
.PP
Unter Windows benötigen Sie die Option \f(CW\*(C`\-gb\*(C'\fR, um UTF\-16\-Dateien in \s-1GB18030\s0
umwandeln zu können.
.PP
In \s-1GB 18030\s0 kodierte Dateien haben wie Unicode-Dateien eine Markierung der
Bytereihenfolge (\s-1BOM\s0).
.SH "BEISPIELE"
.IX Header "BEISPIELE"
Aus der Standardeingabe lesen und in die Standardausgabe schreiben:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit\-Modus umwandeln
und ersetzen:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
a.txt aus dem Mac\- in das Unix-Format umwandeln:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
a.txt aus dem Unix\- in das Mac-Format umwandeln:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
a.txt unter Beibehaltung des ursprünglichen Zeitstempels umwandeln:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den
gleichen Zeitstempel erhält wie a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach e.txt
schreiben:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln und
ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das Ergebnis
nach f.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "REKURSIVE UMWANDLUNG"
.IX Header "REKURSIVE UMWANDLUNG"
Verwenden Sie dos2unix zusammen mit den Befehlen \fIfind\fR\|(1) und \fIxargs\fR\|(1), um
Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um beispielsweise
alle *.txt\-Dateien im aktuellen Verzeichnis und dessen Unterverzeichnissen
umzuwandeln, geben Sie Folgendes ein:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISIERUNG"
.IX Header "LOKALISIERUNG"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Die primäre Sprache wird durch die Umgebungsvariable \s-1LANG\s0 festgelegt. Diese
Variable besteht aus mehreren Teilen: Der erste Teil besteht aus zwei
Kleinbuchstaben, die den Sprachcode angeben. Der zweite Teil ist optional
und bezeichnet den Ländercode in Großbuchstaben, vom davor stehenden
Sprachcode durch einen Unterstrich getrennt. Der dritte Teil ist ebenfalls
optional und gibt die Zeichenkodierung an, vom Ländercode durch einen Punkt
getrennt. Einige Beispiele für Standard-POSIX-Shells:
.Sp
.Vb 7
\& export LANG=de Deutsch
\& export LANG=de_DE Deutsch, Deutschland
\& export LANG=de_AT Deutsch, Österreich
\& export LANG=es_ES Spanisch, Spanien
\& export LANG=es_MX Spanisch, Mexiko
\& export LANG=en_US.iso88591 Englisch, USA, Latin\-1\-Zeichenkodierung
\& export LANG=en_GB.UTF\-8 Englisch, GB, UTF\-8\-Zeichenkodierung
.Ve
.Sp
Eine vollständige Liste der Sprachen und Ländercodes finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Auf Unix-Systemen erhalten Sie mit dem Befehl \fIlocale\fR\|(1) spezifische
Informationen zu den Spracheinstellungen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Mit der Umgebungsvariable \s-1LANGUAGE\s0 können Sie eine Prioritätenliste für
Sprachen übergeben, die Sie durch Doppelpunkte voneinander trennen. Dos2unix
gibt \s-1LANGUAGE\s0 vor \s-1LANG\s0 den Vorzug, zum Beispiel bei Deutsch vor
Niederländisch: \f(CW\*(C`LANGUAGE=de:nl\*(C'\fR. Sie müssen zunächst die Lokalisierung
aktivieren, indem Sie die Variable \s-1LANG \s0(oder \s-1LC_ALL\s0) auf einen anderen Wert
als »C« setzen, bevor Sie die Liste der Sprachprioritäten mit der Variable
\&\s-1LANGUAGE\s0 nutzen können. Weitere Informationen finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Falls Sie eine Sprache auswählen, die nicht verfügbar ist, erhalten Sie die
Standardmeldungen in englischer Sprache.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Durch die Umgebungsvariable \s-1DOS2UNIX_LOCALEDIR\s0 wird \s-1LOCALEDIR\s0 während der
Kompilierung übergangen. \s-1LOCALEDIR\s0 wird verwendet, um Sprachdateien zu
finden. Der GNU-Standardwert ist \f(CW\*(C`/usr/local/share/locale\*(C'\fR. Die Option
\&\fB\-\-version\fR zeigt das verwendete \s-1LOCALEDIR\s0 an.
.Sp
Beispiel (POSIX-Shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RÜCKGABEWERT"
.IX Header "RÜCKGABEWERT"
Bei Erfolg wird 0 zurückgegeben. Bei aufgetretenen Systemfehlern wird der
letzte Systemfehler zurückgegeben. Für alle anderen Fehler wird 1
zurückgegeben.
.PP
Der Rückgabewert ist im stillen Modus stets 0, außer wenn fehlerhafte
Befehlszeilenoptionen verwendet werden.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://de.wikipedia.org/wiki/Textdatei>
.PP
<http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf>
.PP
<http://de.wikipedia.org/wiki/Zeilenumbruch>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTOREN"
.IX Header "AUTOREN"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(Mac2unix\-Modus) \- <wuebben@kde.org>, Christian Wurll (Extra Zeilenumbruch)
\&\- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (Betreuer)
.PP
Projektseite: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-Seite: <http://sourceforge.net/projects/dos2unix/>
.SH "SIEHE AUCH"
.IX Header "SIEHE AUCH"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,781 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "BEZEICHNUNG"
.IX Header "BEZEICHNUNG"
dos2unix \- Formatumwandlung für Textdateien von DOS/Mac nach Unix und
umgekehrt
.SH "ÜBERSICHT"
.IX Header "ÜBERSICHT"
.Vb 2
\& dos2unix [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
\& unix2dos [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
.Ve
.SH "BESCHREIBUNG"
.IX Header "BESCHREIBUNG"
Das Paket Dos2unix enthält die Werkzeuge \f(CW\*(C`dos2unix\*(C'\fR und \f(CW\*(C`unix2dos\*(C'\fR zum
Umwandeln einfacher Textdateien aus dem \s-1DOS\-\s0 oder Mac-Format in das
Unix-Format und umgekehrt.
.PP
In Textdateien unter DOS/Windows sind Zeilenumbrüche, auch als neue Zeile
(\s-1NL\s0) bekannt, eine Kombination aus zwei Zeichen: einem Wagenrücklauf
(Carriage Return, \s-1CR\s0) gefolgt von einem Zeilenvorschub (Line Feed, \s-1LF\s0). In
Unix-Textdateien bestehen Zeilenumbrüche nur aus einem Zeichen, dem
Zeilenvorschub (\s-1LF\s0). In Mac-Textdateien aus der Zeit vor MacOSX bestand ein
Zeilenumbruch aus einem einzelnen CR-Zeichen. Heute verwendet Mac \s-1OS\s0
Zeilenumbrüche im Unix-Stil (\s-1LF\s0).
.PP
Neben Zeilenumbrüchen kann Dos2unix auch die Zeichenkodierung von Dateien
umwandeln. Einige DOS-Codepages können in Unix Latin\-1 umgewandelt werden,
und Windows-Unicode-Dateien (\s-1UTF\-16\s0) können in Unix-Unicode-Dateien (\s-1UTF\-8\s0)
umgewandelt werden.
.PP
Binärdateien werden automatisch übersprungen, sofern die Umwandlung nicht
erzwungen wird.
.PP
Nicht\-reguläre Dateien, wie Verzeichnisse und \s-1FIFOS \s0(Weiterleitungen) werden
automatisch übersprungen.
.PP
Symbolische Links und deren Ziele werden per Vorgabe unverändert
belassen. Symbolische Links können optional ersetzt werden, oder die Ausgabe
wird in das Ziel des symbolischen Links geschrieben. Unter Windows wird das
Schreiben in das Ziel eines symbolischen Links nicht unterstützt.
.PP
Dos2unix wurde nach dem Vorbild der dos2unix\-Version unter SunOS/Solaris
entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese Version
ersetzt per Vorgabe Dateien bei der Umwandlung (Alte-Datei-Modus), während
unter SunOS/Solaris nur die paarweise Umwandlung (Neue-Datei-Modus)
unterstützt wird. Siehe dazu die Optionen \f(CW\*(C`\-o\*(C'\fR und \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONEN"
.IX Header "OPTIONEN"
.IP "\fB\-\-\fR" 4
.IX Item "--"
nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese Option,
wenn Sie Dateien umwandeln wollen, deren Namen mit einem Minuszeichen
beginnen. Um beispielsweise eine Datei namens »\-bla« umzuwandeln, können Sie
folgenden Befehl verwenden:
.Sp
.Vb 1
\& dos2unix \-\- \-bla
.Ve
.Sp
oder im Neue-Datei-Modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-bla ausgabe.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
wandelt nur Zeilenumbrüche um. Dies ist der vorgegebene Umwandlungsmodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
wandelt aus dem \s-1DOS\-\s0 in den ISO\-8859\-1\-Zeichensatz um. Weitere Informationen
hierzu finden Sie im Abschnitt \s-1UMWANDLUNGSMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
verwendet die Windows-Codepage 1252 (Westeuropäisch).
.IP "\fB\-437\fR" 4
.IX Item "-437"
verwendet die DOS-Codepage 437 (\s-1US\s0). Dies ist die vorgegebene Codepage für
die ISO-Umwandlung.
.IP "\fB\-850\fR" 4
.IX Item "-850"
verwendet die DOS-Codepage 850 (Westeuropäisch).
.IP "\fB\-860\fR" 4
.IX Item "-860"
verwendet die DOS-Codepage 860 (Portugiesisch).
.IP "\fB\-863\fR" 4
.IX Item "-863"
verwendet die DOS-Codepage 863 (Kanadisches Französisch).
.IP "\fB\-865\fR" 4
.IX Item "-865"
verwendet die DOS-Codepage 865 (Skandinavisch).
.IP "\fB\-7\fR" 4
.IX Item "-7"
wandelt 8bit\-Zeichen in ein 7bit\-Bitmuster um.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
erhält die Markierung der Bytereihenfolge (\s-1BOM\s0). Wenn die Eingabedatei eine
\&\s-1BOM\s0 enthält, wird ebenfalls eine \s-1BOM\s0 in die Ausgabedatei geschrieben. Dies
ist das Standardverhalten beim Umwandeln von DOS\-Zeilenumbrüchen. Siehe auch
die Option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1UMWANDLUNGSMODUS\s0\fR" 4
.IX Item "-c, --convmode UMWANDLUNGSMODUS"
legt den Umwandlungsmodus fest. \s-1UMWANDLUNGSMODUS\s0 kann \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR oder \fImac\fR sein, wobei \fIascii\fR die Vorgabe ist.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
erzwingt die Umwandlung von Binärdateien.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
wandelt unter Windows UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 um, ungeachtet
der Einstellung der Locale. Verwenden Sie diese Option zum umwandeln von
Utf\-16\-Dateien in \s-1GB18030.\s0 Diese Option ist nur unter Windows
verfügbar. Siehe auch Abschnitt \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
zeigt eine Hilfe an und beendet das Programm.
.IP "\fB\-i[\s-1SCHALTER\s0], \-\-info[=SCHALTER] \s-1DATEI\s0\fR" 4
.IX Item "-i[SCHALTER], --info[=SCHALTER] DATEI"
zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.
.Sp
Die Ausgabe der Informationen geschieht in der folgenden Reihenfolge: Anzahl
der DOS\-Zeilenumbrüche, Anzahl der Unix\-Zeilenumbrüche, Anzahl der
Mac\-Zeilenumbrüche, Markierung der Bytereihenfolge, Text\- oder Binärformat,
Dateiname.
.Sp
Beispielausgabe:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionale zusätzliche Schalter können gesetzt werden, um die Ausgabe
anzupassen. Einer oder mehrere Schalter können hinzugefügt werden.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
gibt die Anzahl der DOS\-Zeilenumbrüche aus.
.IP "\fBu\fR" 4
.IX Item "u"
gibt die Anzahl der Unix\-Zeilenumbrüche aus.
.IP "\fBm\fR" 4
.IX Item "m"
gibt die Anzahl der Mac\-Zeilenumbrüche aus.
.IP "\fBb\fR" 4
.IX Item "b"
gibt die Markierung der Bytereihenfolge aus.
.IP "\fBt\fR" 4
.IX Item "t"
zeigt an, ob es sich um eine Text\- oder eine Binärdatei handelt.
.IP "\fBc\fR" 4
.IX Item "c"
gibt nur die Dateien aus, die umgewandelt werden würden.
.Sp
Mit dem Schalter \f(CW\*(C`c\*(C'\fR gibt dos2unix nur die Dateien aus, die
DOS\-Zeilenumbrüche enthalten, unix2dos nur die Dateien mit
Unix\-Zeilenumbrüchen.
.RE
.RS 4
.Sp
Beispiele:
.Sp
Informationen zu allen *.txt\-Dateien anzeigen:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Nur die Anzahl der DOS\-Zeilenumbrüche und Unix\-Zeilenumbrüche anzeigen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Nur die Markierung der Bytereihenfolge anzeigen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Die Dateien auflisten, die DOS\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Die Dateien auflisten, die Unix\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
übernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
zeigt die Lizenz des Programms an.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
fügt eine zusätzliche neue Zeile hinzu.
.Sp
\&\fBdos2unix\fR: Nur DOS\-Zeilenumbrüche werden in Unix\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Mac\-Zeilenumbrüche in
Unix\-Zeilenumbrüche umgewandelt.
.Sp
\&\fBunix2dos\fR: Nur Unix\-Zeilenumbrüche werden in DOS\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Unix\-Zeilenumbrüche in
Mac\-Zeilenumbrüche umgewandelt.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
schreibt eine Markierung der Bytereihenfolge (\s-1BOM\s0) in die Ausgabedatei. In
der Voreinstellung wird eine \s-1UTF\-8\-BOM\s0 geschrieben.
.Sp
Wenn die Eingabedatei in \s-1UTF\-16\s0 kodiert ist und die Option \f(CW\*(C`\-u\*(C'\fR verwendet
wird, wird eine \s-1UTF\-16\-BOM\s0 geschrieben.
.Sp
Verwenden Sie diese Option niemals, wenn die Kodierung der Ausgabedatei
weder \s-1UTF\-8\s0 noch \s-1UTF\-16\s0 ist. Weitere Informationen finden Sie im Abschnitt
\&\s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1EINGABEDATEI AUSGABEDATEI\s0 …\fR" 4
.IX Item "-n, --newfile EINGABEDATEI AUSGABEDATEI …"
Neue-Datei-Modus. Die \s-1EINGABEDATEI\s0 wird umgewandelt und in die \s-1AUSGABEDATEI\s0
geschrieben. Die Dateinamen müssen paarweise angegeben werden. Platzhalter
sollten \fInicht\fR verwendet werden, sonst werden Sie Ihre Dateien
\&\fIverlieren\fR.
.Sp
Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird Besitzer
der umgewandelten Datei. Die Lese\- und Schreibrechte werden aus den
Zugriffsrechten der Originaldatei minus der \fIumask\fR\|(1) der Person ermittelt,
die die Umwandlung ausgeführt hat.
.IP "\fB\-o, \-\-oldfile \s-1DATEI\s0 …\fR" 4
.IX Item "-o, --oldfile DATEI …"
Alte-Datei-Modus. Die \s-1DATEI\s0 wird umgewandelt und durch die Ausgabedatei
überschrieben. Per Vorgabe werden Umwandlungen in diesem Modus
ausgeführt. Platzhalter sind verwendbar.
.Sp
Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten Dateien den
gleichen Eigentümer, die gleiche Gruppe und die gleichen Lese\- und
Schreibberechtigungen wie die Originaldatei, auch wenn die Datei von einem
anderen Benutzer umgewandelt wird, der Schreibrechte für die Datei hat (zum
Beispiel der Systemadministrator). Die Umwandlung wird abgebrochen, wenn es
nicht möglich ist, die originalen Werte beizubehalten. Die Änderung des
Eigentümers könnte zum Beispiel bewirken, dass der ursprüngliche Eigentümer
die Datei nicht mehr lesen kann. Die Änderung der Gruppe könnte ein
Sicherheitsrisiko sein, da die Datei vielleicht für Benutzer lesbar wird,
für die sie nicht bestimmt ist. Die Beibehaltung von Eigentümer, Gruppe und
Schreib\- und Leserechten wird nur unter Unix unterstützt.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stiller Modus, in dem alle Warnungen und sonstige Meldungen unterdrückt
werden. Der Rückgabewert ist 0, außer wenn fehlerhafte Befehlszeilenoptionen
angegeben werden.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
entfernt die Markierung der Bytereihenfolge (\s-1BOM\s0). Es wird keine \s-1BOM\s0 in die
Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von
Unix\-Zeilenumbrüchen. Siehe auch die Option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
überspringt Binärdateien (Vorgabe).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
erhält die originale UTF\-16\-Kodierung der Eingabedatei. Die Ausgabedatei
wird in der gleichen UTF\-16\-Kodierung geschrieben (Little\-Endian\- oder
Big-Endian-Bytereihenfolge) wie die Eingabedatei. Dies verhindert die
Umwandlung in \s-1UTF\-8.\s0 Eine \s-1UTF\-16\-BOM\s0 wird dementsprechend geschrieben. Diese
Option kann durch Angabe der Option \f(CW\*(C`\-ascii\*(C'\fR deaktiviert werden.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16LE\s0 hat.
.Sp
Wenn die Eingabedatei eine Markierung der Bytereihenfolge enthält (\s-1BOM\s0),
dann hat die \s-1BOM\s0 Vorrang vor dieser Option.
.Sp
Durch eine falsche Annahme (die Eingabedatei war nicht in \s-1UTF\-16LE\s0 kodiert)
mit erfolgreicher Umwandlung erhalten Sie eine UTF\-8\-Ausgabedatei mit
fehlerhaftem Text. Sie können die fehlgeschlagene Umwandlung mit \fIiconv\fR\|(1)
rückgängig machen, indem Sie die Rückumwandlung von \s-1UTF\-8\s0 nach \s-1UTF\-16LE\s0
vornehmen. Dadurch gewinnen Sie die Originaldatei zurück.
.Sp
Die Annahme von \s-1UTF\-16LE\s0 wirkt wie ein \fIUmwandlungsmodus\fR. Beim Wechsel zum
vorgegebenen \fIascii\fR\-Modus wird die UTF16LE\-Annahme deaktiviert.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16BE\s0 hat.
.Sp
Diese Option ist gleichbedeutend mit \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
zeigt ausführliche Meldungen an. Zusätzliche Informationen werden zu den
Markierungen der Bytereihenfolge (\s-1BOM\s0) und zur Anzahl der umgewandelten
Zeilenumbrüche angezeigt.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
folgt symbolischen Links und wandelt die Zieldateien um.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
ersetzt symbolische Links durch die umgewandelten Dateien (die originalen
Zieldateien bleiben unverändert).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
erhält symbolische Links als solche und lässt die Ziele unverändert
(Vorgabe).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
zeigt Versionsinformationen an und beendet das Programm.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
Im Normalmodus werden Zeilenumbrüche von \s-1DOS\s0 nach Unix und umgekehrt
umgewandelt. Mac\-Zeilenumbrüche werden nicht verändert.
.PP
Im Mac-Modus werden Zeilenumbrüche von Mac nach Unix und umgekehrt
umgewandelt. DOS\-Zeilenumbrüche werden nicht verändert.
.PP
Um das Programm im Mac-Modus auszuführen, verwenden Sie die
Befehlszeilenoption \f(CW\*(C`\-c mac\*(C'\fR oder die Befehle \f(CW\*(C`mac2unix\*(C'\fR oder \f(CW\*(C`unix2mac\*(C'\fR.
.SH "UMWANDLUNGSMODI"
.IX Header "UMWANDLUNGSMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
Im \f(CW\*(C`ascii\*(C'\fR\-Modus werden nur Zeilenumbrüche umgewandelt. Dies ist der
vorgegebene Umwandlungsmodus.
.Sp
Obwohl der Name dieses Modus auf \s-1ASCII\s0 hinweist, welches ein 7\-bit\-Standard
ist, bezieht sich der eigentliche Modus auf 8 Bit. Verwenden Sie diesen
Modus immer dann, wenn Sie Unicode-Dateien in UTF\-8\-Kodierung umwandeln.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das
7\-Bit\-Bitmuster umgewandelt.
.IP "\fBiso\fR" 4
.IX Item "iso"
Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den
ISO-Zeichensatz \s-1ISO\-8859\-1 \s0(Latin\-1) in Unix umgewandelt. DOS-Zeichen ohne
Äquivalent in \s-1ISO\-8859\-1,\s0 für die die Umwandlung nicht möglich ist, werden
durch einen Punkt ersetzt. Gleiches gilt für ISO\-8859\-1\-Zeichen ohne
DOS\-Gegenstück.
.Sp
Wenn nur die Option \f(CW\*(C`\-iso\*(C'\fR angegeben ist, versucht dos2unix die aktive
Codepage selbst zu ermitteln. Sollte dies nicht möglich sein, wird die
Standard-Codepage \s-1CP437\s0 verwendet, welche hauptsächlich in den \s-1USA\s0
eingesetzt wird. Um eine bestimmte Codepage zu erzwingen, verwenden Sie die
Optionen \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Westeuropäisch), \f(CW\*(C`\-860\*(C'\fR (Portugiesisch),
\&\f(CW\*(C`\-863\*(C'\fR (Kanadisches Französisch) oder \f(CW\*(C`\-865\*(C'\fR (Skandinavisch). Die
Windows-Codepage \s-1CP1252 \s0(Westeuropäisch) wird durch die Option \f(CW\*(C`\-1252\*(C'\fR
unterstützt.
.Sp
Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In \s-1UTF\-8\s0
kodierte Dateien werden dadurch beschädigt.
.Sp
Einige Beispiele:
.Sp
Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt ausgabe.txt
.Ve
.Sp
Umwandlung von \s-1DOS CP850\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 eingabe.txt | dos2unix > ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 in die vorgegebene DOS-Codepage:
.Sp
.Vb 1
\& unix2dos \-iso \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix \s-1UTF\-8 \s0(Unicode) nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t CP1252 > ausgabe.txt
.Ve
.Sp
Siehe auch <http://czyborra.com/charsets/codepages.html> und
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Zeichenkodierungen"
.IX Subsection "Zeichenkodierungen"
Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux sind
Unicode-Dateien typischerweise in \s-1UTF\-8\s0 kodiert. Unter Windows können
Textdateien in \s-1UTF\-8, UTF\-16\s0 oder \s-1UTF\-16\s0 in Big-Endian-Bytereihenfolge
kodiert sein, liegen aber meist im Format \s-1UTF\-16\s0 vor.
.SS "Umwandlung"
.IX Subsection "Umwandlung"
Unicode-Textdateien können \s-1DOS\-,\s0 Unix\- oder Mac\-Zeilenumbrüche enthalten, so
wie reguläre Textdateien.
.PP
Alle Versionen von dos2unix und unix2dos können UTF\-8\-kodierte Dateien
umwandeln, weil \s-1UTF\-8\s0 im Hinblick auf Abwärtskompatiblität mit \s-1ASCII\s0
entwickelt wurde.
.PP
Dos2unix und unix2dos mit Unterstützung für \s-1UTF\-16\s0 können in \s-1UTF\-16\s0 kodierte
Dateien in Little\-Endian\- und Big-Endian-Bytereihenfolge lesen. Um
festzustellen, ob dos2unix mit UTF\-16\-Unterstützung kompiliert wurde, geben
Sie \f(CW\*(C`dos2unix \-V\*(C'\fR ein.
.PP
Unter Unix/Linux werden \s-1UTF\-16\s0 kodierte Dateien standardmäßig in die
Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl
\&\fIlocale\fR\|(1) können Sie herausfinden, wie die Zeichenkodierung der Locale
eingestellt ist. Wenn eine Umwandlung nicht möglich ist, verursacht dies
einen Umwandlungsfehler, wodurch die Datei übersprungen wird.
.PP
Unter Windows werden UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 umgewandelt. In
\&\s-1UTF\-8\s0 formatierte Textdateien werden von Windows und Unix/Linux
gleichermaßen unterstützt.
.PP
Die Kodierungen \s-1UTF\-16\s0 und \s-1UTF\-8\s0 sind vollständig kompatibel, daher wird bei
der Umwandlung keinerlei Text verlorengehen. Sollte bei der Umwandlung von
\&\s-1UTF\-16\s0 in \s-1UTF\-8\s0 ein Problem auftreten, beispielsweise wenn die
UTF\-16\-kodierte Eingabedatei einen Fehler enthält, dann wird diese Datei
übersprungen.
.PP
Wenn die Option \f(CW\*(C`\-u\*(C'\fR verwendet wird, wird die Ausgabedatei in der gleichen
UTF\-16\-Kodierung wie die Eingabedatei geschrieben. Die Option \f(CW\*(C`\-u\*(C'\fR
verhindert die Umwandlung in \s-1UTF\-8.\s0
.PP
Dos2unix und unix2dos bieten keine Option zur Umwandlung von UTF\-8\-Dateien
in \s-1UTF\-16.\s0
.PP
Umwandlungen im \s-1ISO\-\s0 und 7bit\-Modus funktionieren mit UTF\-16\-Dateien nicht.
.SS "Markierung der Bytereihenfolge"
.IX Subsection "Markierung der Bytereihenfolge"
Unicode-Textdateien unter Windows haben typischerweise eine Markierung der
Bytereihenfolge (\s-1BOM\s0), da viele Windows-Programme (zum Beispiel Notepad)
solche BOMs standardmäßig hinzufügen. Weitere Informationen hierzu finden
Sie auf <http://de.wikipedia.org/wiki/Byte\-Reihenfolge>.
.PP
Unter Unix haben Textdateien üblicherweise keine \s-1BOM.\s0 Es wird stattdessen
angenommen, dass Textdateien in der Zeichenkodierung entsprechend der
Spracheinstellung vorliegen.
.PP
Dos2unix kann nur dann erkennen, ob eine Datei UTF\-16\-kodiert ist, wenn die
Datei eine \s-1BOM\s0 enthält. Ist dies nicht der Fall, nimmt dos2unix an, dass es
sich um eine Binärdatei handelt.
.PP
Verwenden Sie die Optionen \f(CW\*(C`\-ul\*(C'\fR oder \f(CW\*(C`\-ub\*(C'\fR, um eine UTF\-16\-Datei ohne \s-1BOM\s0
umzuwandeln.
.PP
Dos2unix schreibt in der Voreinstellung keine \s-1BOM\s0 in die Ausgabedatei. Mit
der Option \f(CW\*(C`\-b\*(C'\fR schreibt Dos2unix eine \s-1BOM,\s0 wenn die Eingabedatei ebenfalls
eine \s-1BOM\s0 hat.
.PP
Unix2dos schreibt in der Voreinstellung eine \s-1BOM\s0 in die Ausgabedatei, wenn
die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden Sie die
Option \f(CW\*(C`\-r\*(C'\fR, um die \s-1BOM\s0 zu entfernen.
.PP
Dos2unix und unix2dos schreiben immer eine \s-1BOM,\s0 wenn die Option \f(CW\*(C`\-m\*(C'\fR
angegeben ist.
.SS "Unicode-Beispiele"
.IX Subsection "Unicode-Beispiele"
Umwandlung von Windows \s-1UTF\-16 \s0(mit \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Windows \s-1UTF\-16LE \s0(ohne \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-8\s0 mit \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t UTF\-16 > ausgabe.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 ist ein Standard der chinesischen Regierung. Eine Teilmenge des in
\&\s-1GB18030\s0 definierten Standards ist offiziell für alle in China verkauften
Softwareprodukte vorgeschrieben. Siehe auch
<http://de.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 ist vollständig zu Unicode kompatibel und kann als
Unicode-Umwandlungsformat betrahctet werden. Wie auch \s-1UTF\-8\s0 ist \s-1GB18030\s0
kompatibel zu \s-1ASCII.\s0 Ebenfalls kompatibel ist es zur Codepage 936 von
Windows, auch als \s-1GBK\s0 bekannt.
.PP
Unter Unix/Linux werden UTF\-16\-Dateien in \s-1GB18030\s0 umgewandelt, wenn die
Einstellung der Locale auf \s-1GB18030\s0 gesetzt ist. Beachten Sie, dass dies nur
funktioniert, wenn der Ort auf »China« gesetzt ist. Zum Beispiel wird in
einer Locale-Einstellung \f(CW\*(C`en_GB.GB18030\*(C'\fR (Britisches Englisch) die
Umwandlung von \s-1UTF\-16\s0 in \s-1GB18030\s0 nicht möglich sein, aber in der
chinesischen Einstellung \f(CW\*(C`zh_CN.GB18030\*(C'\fR dagegen funktionieren.
.PP
Unter Windows benötigen Sie die Option \f(CW\*(C`\-gb\*(C'\fR, um UTF\-16\-Dateien in \s-1GB18030\s0
umwandeln zu können.
.PP
In \s-1GB 18030\s0 kodierte Dateien haben wie Unicode-Dateien eine Markierung der
Bytereihenfolge (\s-1BOM\s0).
.SH "BEISPIELE"
.IX Header "BEISPIELE"
Aus der Standardeingabe lesen und in die Standardausgabe schreiben:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit\-Modus umwandeln
und ersetzen:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
a.txt aus dem Mac\- in das Unix-Format umwandeln:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
a.txt aus dem Unix\- in das Mac-Format umwandeln:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
a.txt unter Beibehaltung des ursprünglichen Zeitstempels umwandeln:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den
gleichen Zeitstempel erhält wie a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach e.txt
schreiben:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln und
ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das Ergebnis
nach f.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "REKURSIVE UMWANDLUNG"
.IX Header "REKURSIVE UMWANDLUNG"
Verwenden Sie dos2unix zusammen mit den Befehlen \fIfind\fR\|(1) und \fIxargs\fR\|(1), um
Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um beispielsweise
alle *.txt\-Dateien im aktuellen Verzeichnis und dessen Unterverzeichnissen
umzuwandeln, geben Sie Folgendes ein:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISIERUNG"
.IX Header "LOKALISIERUNG"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Die primäre Sprache wird durch die Umgebungsvariable \s-1LANG\s0 festgelegt. Diese
Variable besteht aus mehreren Teilen: Der erste Teil besteht aus zwei
Kleinbuchstaben, die den Sprachcode angeben. Der zweite Teil ist optional
und bezeichnet den Ländercode in Großbuchstaben, vom davor stehenden
Sprachcode durch einen Unterstrich getrennt. Der dritte Teil ist ebenfalls
optional und gibt die Zeichenkodierung an, vom Ländercode durch einen Punkt
getrennt. Einige Beispiele für Standard-POSIX-Shells:
.Sp
.Vb 7
\& export LANG=de Deutsch
\& export LANG=de_DE Deutsch, Deutschland
\& export LANG=de_AT Deutsch, Österreich
\& export LANG=es_ES Spanisch, Spanien
\& export LANG=es_MX Spanisch, Mexiko
\& export LANG=en_US.iso88591 Englisch, USA, Latin\-1\-Zeichenkodierung
\& export LANG=en_GB.UTF\-8 Englisch, GB, UTF\-8\-Zeichenkodierung
.Ve
.Sp
Eine vollständige Liste der Sprachen und Ländercodes finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Auf Unix-Systemen erhalten Sie mit dem Befehl \fIlocale\fR\|(1) spezifische
Informationen zu den Spracheinstellungen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Mit der Umgebungsvariable \s-1LANGUAGE\s0 können Sie eine Prioritätenliste für
Sprachen übergeben, die Sie durch Doppelpunkte voneinander trennen. Dos2unix
gibt \s-1LANGUAGE\s0 vor \s-1LANG\s0 den Vorzug, zum Beispiel bei Deutsch vor
Niederländisch: \f(CW\*(C`LANGUAGE=de:nl\*(C'\fR. Sie müssen zunächst die Lokalisierung
aktivieren, indem Sie die Variable \s-1LANG \s0(oder \s-1LC_ALL\s0) auf einen anderen Wert
als »C« setzen, bevor Sie die Liste der Sprachprioritäten mit der Variable
\&\s-1LANGUAGE\s0 nutzen können. Weitere Informationen finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Falls Sie eine Sprache auswählen, die nicht verfügbar ist, erhalten Sie die
Standardmeldungen in englischer Sprache.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Durch die Umgebungsvariable \s-1DOS2UNIX_LOCALEDIR\s0 wird \s-1LOCALEDIR\s0 während der
Kompilierung übergangen. \s-1LOCALEDIR\s0 wird verwendet, um Sprachdateien zu
finden. Der GNU-Standardwert ist \f(CW\*(C`/usr/local/share/locale\*(C'\fR. Die Option
\&\fB\-\-version\fR zeigt das verwendete \s-1LOCALEDIR\s0 an.
.Sp
Beispiel (POSIX-Shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RÜCKGABEWERT"
.IX Header "RÜCKGABEWERT"
Bei Erfolg wird 0 zurückgegeben. Bei aufgetretenen Systemfehlern wird der
letzte Systemfehler zurückgegeben. Für alle anderen Fehler wird 1
zurückgegeben.
.PP
Der Rückgabewert ist im stillen Modus stets 0, außer wenn fehlerhafte
Befehlszeilenoptionen verwendet werden.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://de.wikipedia.org/wiki/Textdatei>
.PP
<http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf>
.PP
<http://de.wikipedia.org/wiki/Zeilenumbruch>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTOREN"
.IX Header "AUTOREN"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(Mac2unix\-Modus) \- <wuebben@kde.org>, Christian Wurll (Extra Zeilenumbruch)
\&\- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (Betreuer)
.PP
Projektseite: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-Seite: <http://sourceforge.net/projects/dos2unix/>
.SH "SIEHE AUCH"
.IX Header "SIEHE AUCH"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,781 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "BEZEICHNUNG"
.IX Header "BEZEICHNUNG"
dos2unix \- Formatumwandlung für Textdateien von DOS/Mac nach Unix und
umgekehrt
.SH "ÜBERSICHT"
.IX Header "ÜBERSICHT"
.Vb 2
\& dos2unix [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
\& unix2dos [Optionen] [DATEI …] [\-n EINGABEDATEI AUSGABEDATEI …]
.Ve
.SH "BESCHREIBUNG"
.IX Header "BESCHREIBUNG"
Das Paket Dos2unix enthält die Werkzeuge \f(CW\*(C`dos2unix\*(C'\fR und \f(CW\*(C`unix2dos\*(C'\fR zum
Umwandeln einfacher Textdateien aus dem \s-1DOS\-\s0 oder Mac-Format in das
Unix-Format und umgekehrt.
.PP
In Textdateien unter DOS/Windows sind Zeilenumbrüche, auch als neue Zeile
(\s-1NL\s0) bekannt, eine Kombination aus zwei Zeichen: einem Wagenrücklauf
(Carriage Return, \s-1CR\s0) gefolgt von einem Zeilenvorschub (Line Feed, \s-1LF\s0). In
Unix-Textdateien bestehen Zeilenumbrüche nur aus einem Zeichen, dem
Zeilenvorschub (\s-1LF\s0). In Mac-Textdateien aus der Zeit vor MacOSX bestand ein
Zeilenumbruch aus einem einzelnen CR-Zeichen. Heute verwendet Mac \s-1OS\s0
Zeilenumbrüche im Unix-Stil (\s-1LF\s0).
.PP
Neben Zeilenumbrüchen kann Dos2unix auch die Zeichenkodierung von Dateien
umwandeln. Einige DOS-Codepages können in Unix Latin\-1 umgewandelt werden,
und Windows-Unicode-Dateien (\s-1UTF\-16\s0) können in Unix-Unicode-Dateien (\s-1UTF\-8\s0)
umgewandelt werden.
.PP
Binärdateien werden automatisch übersprungen, sofern die Umwandlung nicht
erzwungen wird.
.PP
Nicht\-reguläre Dateien, wie Verzeichnisse und \s-1FIFOS \s0(Weiterleitungen) werden
automatisch übersprungen.
.PP
Symbolische Links und deren Ziele werden per Vorgabe unverändert
belassen. Symbolische Links können optional ersetzt werden, oder die Ausgabe
wird in das Ziel des symbolischen Links geschrieben. Unter Windows wird das
Schreiben in das Ziel eines symbolischen Links nicht unterstützt.
.PP
Dos2unix wurde nach dem Vorbild der dos2unix\-Version unter SunOS/Solaris
entwickelt, doch es gitb einen wesentlichen Unterschied zu: Diese Version
ersetzt per Vorgabe Dateien bei der Umwandlung (Alte-Datei-Modus), während
unter SunOS/Solaris nur die paarweise Umwandlung (Neue-Datei-Modus)
unterstützt wird. Siehe dazu die Optionen \f(CW\*(C`\-o\*(C'\fR und \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONEN"
.IX Header "OPTIONEN"
.IP "\fB\-\-\fR" 4
.IX Item "--"
nimmt alle folgenden Optionen als Dateinamen an. Verwenden Sie diese Option,
wenn Sie Dateien umwandeln wollen, deren Namen mit einem Minuszeichen
beginnen. Um beispielsweise eine Datei namens »\-bla« umzuwandeln, können Sie
folgenden Befehl verwenden:
.Sp
.Vb 1
\& dos2unix \-\- \-bla
.Ve
.Sp
oder im Neue-Datei-Modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-bla ausgabe.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
wandelt nur Zeilenumbrüche um. Dies ist der vorgegebene Umwandlungsmodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
wandelt aus dem \s-1DOS\-\s0 in den ISO\-8859\-1\-Zeichensatz um. Weitere Informationen
hierzu finden Sie im Abschnitt \s-1UMWANDLUNGSMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
verwendet die Windows-Codepage 1252 (Westeuropäisch).
.IP "\fB\-437\fR" 4
.IX Item "-437"
verwendet die DOS-Codepage 437 (\s-1US\s0). Dies ist die vorgegebene Codepage für
die ISO-Umwandlung.
.IP "\fB\-850\fR" 4
.IX Item "-850"
verwendet die DOS-Codepage 850 (Westeuropäisch).
.IP "\fB\-860\fR" 4
.IX Item "-860"
verwendet die DOS-Codepage 860 (Portugiesisch).
.IP "\fB\-863\fR" 4
.IX Item "-863"
verwendet die DOS-Codepage 863 (Kanadisches Französisch).
.IP "\fB\-865\fR" 4
.IX Item "-865"
verwendet die DOS-Codepage 865 (Skandinavisch).
.IP "\fB\-7\fR" 4
.IX Item "-7"
wandelt 8bit\-Zeichen in ein 7bit\-Bitmuster um.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
erhält die Markierung der Bytereihenfolge (\s-1BOM\s0). Wenn die Eingabedatei eine
\&\s-1BOM\s0 enthält, wird ebenfalls eine \s-1BOM\s0 in die Ausgabedatei geschrieben. Dies
ist das Standardverhalten beim Umwandeln von DOS\-Zeilenumbrüchen. Siehe auch
die Option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1UMWANDLUNGSMODUS\s0\fR" 4
.IX Item "-c, --convmode UMWANDLUNGSMODUS"
legt den Umwandlungsmodus fest. \s-1UMWANDLUNGSMODUS\s0 kann \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR oder \fImac\fR sein, wobei \fIascii\fR die Vorgabe ist.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
erzwingt die Umwandlung von Binärdateien.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
wandelt unter Windows UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 um, ungeachtet
der Einstellung der Locale. Verwenden Sie diese Option zum umwandeln von
Utf\-16\-Dateien in \s-1GB18030.\s0 Diese Option ist nur unter Windows
verfügbar. Siehe auch Abschnitt \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
zeigt eine Hilfe an und beendet das Programm.
.IP "\fB\-i[\s-1SCHALTER\s0], \-\-info[=SCHALTER] \s-1DATEI\s0\fR" 4
.IX Item "-i[SCHALTER], --info[=SCHALTER] DATEI"
zeigt Dateiinformationen an. Es wird keine Umwandlung vorgenommen.
.Sp
Die Ausgabe der Informationen geschieht in der folgenden Reihenfolge: Anzahl
der DOS\-Zeilenumbrüche, Anzahl der Unix\-Zeilenumbrüche, Anzahl der
Mac\-Zeilenumbrüche, Markierung der Bytereihenfolge, Text\- oder Binärformat,
Dateiname.
.Sp
Beispielausgabe:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionale zusätzliche Schalter können gesetzt werden, um die Ausgabe
anzupassen. Einer oder mehrere Schalter können hinzugefügt werden.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
gibt die Anzahl der DOS\-Zeilenumbrüche aus.
.IP "\fBu\fR" 4
.IX Item "u"
gibt die Anzahl der Unix\-Zeilenumbrüche aus.
.IP "\fBm\fR" 4
.IX Item "m"
gibt die Anzahl der Mac\-Zeilenumbrüche aus.
.IP "\fBb\fR" 4
.IX Item "b"
gibt die Markierung der Bytereihenfolge aus.
.IP "\fBt\fR" 4
.IX Item "t"
zeigt an, ob es sich um eine Text\- oder eine Binärdatei handelt.
.IP "\fBc\fR" 4
.IX Item "c"
gibt nur die Dateien aus, die umgewandelt werden würden.
.Sp
Mit dem Schalter \f(CW\*(C`c\*(C'\fR gibt dos2unix nur die Dateien aus, die
DOS\-Zeilenumbrüche enthalten, unix2dos nur die Dateien mit
Unix\-Zeilenumbrüchen.
.RE
.RS 4
.Sp
Beispiele:
.Sp
Informationen zu allen *.txt\-Dateien anzeigen:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Nur die Anzahl der DOS\-Zeilenumbrüche und Unix\-Zeilenumbrüche anzeigen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Nur die Markierung der Bytereihenfolge anzeigen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Die Dateien auflisten, die DOS\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Die Dateien auflisten, die Unix\-Zeilenumbrüche enthalten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
übernimmt den Zeitstempel der Eingabedatei in die Ausgabedatei.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
zeigt die Lizenz des Programms an.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
fügt eine zusätzliche neue Zeile hinzu.
.Sp
\&\fBdos2unix\fR: Nur DOS\-Zeilenumbrüche werden in Unix\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Mac\-Zeilenumbrüche in
Unix\-Zeilenumbrüche umgewandelt.
.Sp
\&\fBunix2dos\fR: Nur Unix\-Zeilenumbrüche werden in DOS\-Zeilenumbrüche
umgewandelt. Im Mac-Modus werden nur Unix\-Zeilenumbrüche in
Mac\-Zeilenumbrüche umgewandelt.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
schreibt eine Markierung der Bytereihenfolge (\s-1BOM\s0) in die Ausgabedatei. In
der Voreinstellung wird eine \s-1UTF\-8\-BOM\s0 geschrieben.
.Sp
Wenn die Eingabedatei in \s-1UTF\-16\s0 kodiert ist und die Option \f(CW\*(C`\-u\*(C'\fR verwendet
wird, wird eine \s-1UTF\-16\-BOM\s0 geschrieben.
.Sp
Verwenden Sie diese Option niemals, wenn die Kodierung der Ausgabedatei
weder \s-1UTF\-8\s0 noch \s-1UTF\-16\s0 ist. Weitere Informationen finden Sie im Abschnitt
\&\s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1EINGABEDATEI AUSGABEDATEI\s0 …\fR" 4
.IX Item "-n, --newfile EINGABEDATEI AUSGABEDATEI …"
Neue-Datei-Modus. Die \s-1EINGABEDATEI\s0 wird umgewandelt und in die \s-1AUSGABEDATEI\s0
geschrieben. Die Dateinamen müssen paarweise angegeben werden. Platzhalter
sollten \fInicht\fR verwendet werden, sonst werden Sie Ihre Dateien
\&\fIverlieren\fR.
.Sp
Der Benutzer, der die Umwandlung im Neue-Datei-Modus startet, wird Besitzer
der umgewandelten Datei. Die Lese\- und Schreibrechte werden aus den
Zugriffsrechten der Originaldatei minus der \fIumask\fR\|(1) der Person ermittelt,
die die Umwandlung ausgeführt hat.
.IP "\fB\-o, \-\-oldfile \s-1DATEI\s0 …\fR" 4
.IX Item "-o, --oldfile DATEI …"
Alte-Datei-Modus. Die \s-1DATEI\s0 wird umgewandelt und durch die Ausgabedatei
überschrieben. Per Vorgabe werden Umwandlungen in diesem Modus
ausgeführt. Platzhalter sind verwendbar.
.Sp
Im Alte-Datei-Modus (Ersetzungsmodus) erhalten die umgewandelten Dateien den
gleichen Eigentümer, die gleiche Gruppe und die gleichen Lese\- und
Schreibberechtigungen wie die Originaldatei, auch wenn die Datei von einem
anderen Benutzer umgewandelt wird, der Schreibrechte für die Datei hat (zum
Beispiel der Systemadministrator). Die Umwandlung wird abgebrochen, wenn es
nicht möglich ist, die originalen Werte beizubehalten. Die Änderung des
Eigentümers könnte zum Beispiel bewirken, dass der ursprüngliche Eigentümer
die Datei nicht mehr lesen kann. Die Änderung der Gruppe könnte ein
Sicherheitsrisiko sein, da die Datei vielleicht für Benutzer lesbar wird,
für die sie nicht bestimmt ist. Die Beibehaltung von Eigentümer, Gruppe und
Schreib\- und Leserechten wird nur unter Unix unterstützt.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stiller Modus, in dem alle Warnungen und sonstige Meldungen unterdrückt
werden. Der Rückgabewert ist 0, außer wenn fehlerhafte Befehlszeilenoptionen
angegeben werden.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
entfernt die Markierung der Bytereihenfolge (\s-1BOM\s0). Es wird keine \s-1BOM\s0 in die
Ausgabedatei geschrieben. Dies ist das Standardverhalten beim Umwandeln von
Unix\-Zeilenumbrüchen. Siehe auch die Option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
überspringt Binärdateien (Vorgabe).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
erhält die originale UTF\-16\-Kodierung der Eingabedatei. Die Ausgabedatei
wird in der gleichen UTF\-16\-Kodierung geschrieben (Little\-Endian\- oder
Big-Endian-Bytereihenfolge) wie die Eingabedatei. Dies verhindert die
Umwandlung in \s-1UTF\-8.\s0 Eine \s-1UTF\-16\-BOM\s0 wird dementsprechend geschrieben. Diese
Option kann durch Angabe der Option \f(CW\*(C`\-ascii\*(C'\fR deaktiviert werden.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16LE\s0 hat.
.Sp
Wenn die Eingabedatei eine Markierung der Bytereihenfolge enthält (\s-1BOM\s0),
dann hat die \s-1BOM\s0 Vorrang vor dieser Option.
.Sp
Durch eine falsche Annahme (die Eingabedatei war nicht in \s-1UTF\-16LE\s0 kodiert)
mit erfolgreicher Umwandlung erhalten Sie eine UTF\-8\-Ausgabedatei mit
fehlerhaftem Text. Sie können die fehlgeschlagene Umwandlung mit \fIiconv\fR\|(1)
rückgängig machen, indem Sie die Rückumwandlung von \s-1UTF\-8\s0 nach \s-1UTF\-16LE\s0
vornehmen. Dadurch gewinnen Sie die Originaldatei zurück.
.Sp
Die Annahme von \s-1UTF\-16LE\s0 wirkt wie ein \fIUmwandlungsmodus\fR. Beim Wechsel zum
vorgegebenen \fIascii\fR\-Modus wird die UTF16LE\-Annahme deaktiviert.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
nimmt an, dass die Eingabedatei das Format \s-1UTF\-16BE\s0 hat.
.Sp
Diese Option ist gleichbedeutend mit \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
zeigt ausführliche Meldungen an. Zusätzliche Informationen werden zu den
Markierungen der Bytereihenfolge (\s-1BOM\s0) und zur Anzahl der umgewandelten
Zeilenumbrüche angezeigt.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
folgt symbolischen Links und wandelt die Zieldateien um.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
ersetzt symbolische Links durch die umgewandelten Dateien (die originalen
Zieldateien bleiben unverändert).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
erhält symbolische Links als solche und lässt die Ziele unverändert
(Vorgabe).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
zeigt Versionsinformationen an und beendet das Programm.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
Im Normalmodus werden Zeilenumbrüche von \s-1DOS\s0 nach Unix und umgekehrt
umgewandelt. Mac\-Zeilenumbrüche werden nicht verändert.
.PP
Im Mac-Modus werden Zeilenumbrüche von Mac nach Unix und umgekehrt
umgewandelt. DOS\-Zeilenumbrüche werden nicht verändert.
.PP
Um das Programm im Mac-Modus auszuführen, verwenden Sie die
Befehlszeilenoption \f(CW\*(C`\-c mac\*(C'\fR oder die Befehle \f(CW\*(C`mac2unix\*(C'\fR oder \f(CW\*(C`unix2mac\*(C'\fR.
.SH "UMWANDLUNGSMODI"
.IX Header "UMWANDLUNGSMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
Im \f(CW\*(C`ascii\*(C'\fR\-Modus werden nur Zeilenumbrüche umgewandelt. Dies ist der
vorgegebene Umwandlungsmodus.
.Sp
Obwohl der Name dieses Modus auf \s-1ASCII\s0 hinweist, welches ein 7\-bit\-Standard
ist, bezieht sich der eigentliche Modus auf 8 Bit. Verwenden Sie diesen
Modus immer dann, wenn Sie Unicode-Dateien in UTF\-8\-Kodierung umwandeln.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In diesem Modus werden alle Nicht-ASCII-Zeichen aus 8 Bit in das
7\-Bit\-Bitmuster umgewandelt.
.IP "\fBiso\fR" 4
.IX Item "iso"
Die Zeichen werden aus dem DOS-Zeichensatz (der Codepage) in den
ISO-Zeichensatz \s-1ISO\-8859\-1 \s0(Latin\-1) in Unix umgewandelt. DOS-Zeichen ohne
Äquivalent in \s-1ISO\-8859\-1,\s0 für die die Umwandlung nicht möglich ist, werden
durch einen Punkt ersetzt. Gleiches gilt für ISO\-8859\-1\-Zeichen ohne
DOS\-Gegenstück.
.Sp
Wenn nur die Option \f(CW\*(C`\-iso\*(C'\fR angegeben ist, versucht dos2unix die aktive
Codepage selbst zu ermitteln. Sollte dies nicht möglich sein, wird die
Standard-Codepage \s-1CP437\s0 verwendet, welche hauptsächlich in den \s-1USA\s0
eingesetzt wird. Um eine bestimmte Codepage zu erzwingen, verwenden Sie die
Optionen \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Westeuropäisch), \f(CW\*(C`\-860\*(C'\fR (Portugiesisch),
\&\f(CW\*(C`\-863\*(C'\fR (Kanadisches Französisch) oder \f(CW\*(C`\-865\*(C'\fR (Skandinavisch). Die
Windows-Codepage \s-1CP1252 \s0(Westeuropäisch) wird durch die Option \f(CW\*(C`\-1252\*(C'\fR
unterstützt.
.Sp
Wenden Sie niemals die ISO-Umwandlung auf Unicode-Textdateien an. In \s-1UTF\-8\s0
kodierte Dateien werden dadurch beschädigt.
.Sp
Einige Beispiele:
.Sp
Umwandlung aus der vorgegebenen DOS-Codepage nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt ausgabe.txt
.Ve
.Sp
Umwandlung von \s-1DOS CP850\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Windows \s-1CP1252\s0 nach Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 eingabe.txt | dos2unix > ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 in die vorgegebene DOS-Codepage:
.Sp
.Vb 1
\& unix2dos \-iso \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix Latin\-1 nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n eingabe.txt ausgabe.txt
.Ve
.Sp
Umwandlung von Unix \s-1UTF\-8 \s0(Unicode) nach Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t CP1252 > ausgabe.txt
.Ve
.Sp
Siehe auch <http://czyborra.com/charsets/codepages.html> und
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Zeichenkodierungen"
.IX Subsection "Zeichenkodierungen"
Es gibt verschiedene Unicode-Zeichenkodierungen. Unter Unix und Linux sind
Unicode-Dateien typischerweise in \s-1UTF\-8\s0 kodiert. Unter Windows können
Textdateien in \s-1UTF\-8, UTF\-16\s0 oder \s-1UTF\-16\s0 in Big-Endian-Bytereihenfolge
kodiert sein, liegen aber meist im Format \s-1UTF\-16\s0 vor.
.SS "Umwandlung"
.IX Subsection "Umwandlung"
Unicode-Textdateien können \s-1DOS\-,\s0 Unix\- oder Mac\-Zeilenumbrüche enthalten, so
wie reguläre Textdateien.
.PP
Alle Versionen von dos2unix und unix2dos können UTF\-8\-kodierte Dateien
umwandeln, weil \s-1UTF\-8\s0 im Hinblick auf Abwärtskompatiblität mit \s-1ASCII\s0
entwickelt wurde.
.PP
Dos2unix und unix2dos mit Unterstützung für \s-1UTF\-16\s0 können in \s-1UTF\-16\s0 kodierte
Dateien in Little\-Endian\- und Big-Endian-Bytereihenfolge lesen. Um
festzustellen, ob dos2unix mit UTF\-16\-Unterstützung kompiliert wurde, geben
Sie \f(CW\*(C`dos2unix \-V\*(C'\fR ein.
.PP
Unter Unix/Linux werden \s-1UTF\-16\s0 kodierte Dateien standardmäßig in die
Zeichenkodierung entsprechend der Locale umgewandelt. Mit dem Befehl
\&\fIlocale\fR\|(1) können Sie herausfinden, wie die Zeichenkodierung der Locale
eingestellt ist. Wenn eine Umwandlung nicht möglich ist, verursacht dies
einen Umwandlungsfehler, wodurch die Datei übersprungen wird.
.PP
Unter Windows werden UTF\-16\-Dateien standardmäßig in \s-1UTF\-8\s0 umgewandelt. In
\&\s-1UTF\-8\s0 formatierte Textdateien werden von Windows und Unix/Linux
gleichermaßen unterstützt.
.PP
Die Kodierungen \s-1UTF\-16\s0 und \s-1UTF\-8\s0 sind vollständig kompatibel, daher wird bei
der Umwandlung keinerlei Text verlorengehen. Sollte bei der Umwandlung von
\&\s-1UTF\-16\s0 in \s-1UTF\-8\s0 ein Problem auftreten, beispielsweise wenn die
UTF\-16\-kodierte Eingabedatei einen Fehler enthält, dann wird diese Datei
übersprungen.
.PP
Wenn die Option \f(CW\*(C`\-u\*(C'\fR verwendet wird, wird die Ausgabedatei in der gleichen
UTF\-16\-Kodierung wie die Eingabedatei geschrieben. Die Option \f(CW\*(C`\-u\*(C'\fR
verhindert die Umwandlung in \s-1UTF\-8.\s0
.PP
Dos2unix und unix2dos bieten keine Option zur Umwandlung von UTF\-8\-Dateien
in \s-1UTF\-16.\s0
.PP
Umwandlungen im \s-1ISO\-\s0 und 7bit\-Modus funktionieren mit UTF\-16\-Dateien nicht.
.SS "Markierung der Bytereihenfolge"
.IX Subsection "Markierung der Bytereihenfolge"
Unicode-Textdateien unter Windows haben typischerweise eine Markierung der
Bytereihenfolge (\s-1BOM\s0), da viele Windows-Programme (zum Beispiel Notepad)
solche BOMs standardmäßig hinzufügen. Weitere Informationen hierzu finden
Sie auf <http://de.wikipedia.org/wiki/Byte\-Reihenfolge>.
.PP
Unter Unix haben Textdateien üblicherweise keine \s-1BOM.\s0 Es wird stattdessen
angenommen, dass Textdateien in der Zeichenkodierung entsprechend der
Spracheinstellung vorliegen.
.PP
Dos2unix kann nur dann erkennen, ob eine Datei UTF\-16\-kodiert ist, wenn die
Datei eine \s-1BOM\s0 enthält. Ist dies nicht der Fall, nimmt dos2unix an, dass es
sich um eine Binärdatei handelt.
.PP
Verwenden Sie die Optionen \f(CW\*(C`\-ul\*(C'\fR oder \f(CW\*(C`\-ub\*(C'\fR, um eine UTF\-16\-Datei ohne \s-1BOM\s0
umzuwandeln.
.PP
Dos2unix schreibt in der Voreinstellung keine \s-1BOM\s0 in die Ausgabedatei. Mit
der Option \f(CW\*(C`\-b\*(C'\fR schreibt Dos2unix eine \s-1BOM,\s0 wenn die Eingabedatei ebenfalls
eine \s-1BOM\s0 hat.
.PP
Unix2dos schreibt in der Voreinstellung eine \s-1BOM\s0 in die Ausgabedatei, wenn
die Eingabedatei ebenfalls eine solche Markierung hat. Verwenden Sie die
Option \f(CW\*(C`\-r\*(C'\fR, um die \s-1BOM\s0 zu entfernen.
.PP
Dos2unix und unix2dos schreiben immer eine \s-1BOM,\s0 wenn die Option \f(CW\*(C`\-m\*(C'\fR
angegeben ist.
.SS "Unicode-Beispiele"
.IX Subsection "Unicode-Beispiele"
Umwandlung von Windows \s-1UTF\-16 \s0(mit \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Windows \s-1UTF\-16LE \s0(ohne \s-1BOM\s0) nach Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-8\s0 mit \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n eingabe.txt ausgabe.txt
.Ve
.PP
Umwandlung von Unix \s-1UTF\-8\s0 nach Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < eingabe.txt | iconv \-f UTF\-8 \-t UTF\-16 > ausgabe.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 ist ein Standard der chinesischen Regierung. Eine Teilmenge des in
\&\s-1GB18030\s0 definierten Standards ist offiziell für alle in China verkauften
Softwareprodukte vorgeschrieben. Siehe auch
<http://de.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 ist vollständig zu Unicode kompatibel und kann als
Unicode-Umwandlungsformat betrahctet werden. Wie auch \s-1UTF\-8\s0 ist \s-1GB18030\s0
kompatibel zu \s-1ASCII.\s0 Ebenfalls kompatibel ist es zur Codepage 936 von
Windows, auch als \s-1GBK\s0 bekannt.
.PP
Unter Unix/Linux werden UTF\-16\-Dateien in \s-1GB18030\s0 umgewandelt, wenn die
Einstellung der Locale auf \s-1GB18030\s0 gesetzt ist. Beachten Sie, dass dies nur
funktioniert, wenn der Ort auf »China« gesetzt ist. Zum Beispiel wird in
einer Locale-Einstellung \f(CW\*(C`en_GB.GB18030\*(C'\fR (Britisches Englisch) die
Umwandlung von \s-1UTF\-16\s0 in \s-1GB18030\s0 nicht möglich sein, aber in der
chinesischen Einstellung \f(CW\*(C`zh_CN.GB18030\*(C'\fR dagegen funktionieren.
.PP
Unter Windows benötigen Sie die Option \f(CW\*(C`\-gb\*(C'\fR, um UTF\-16\-Dateien in \s-1GB18030\s0
umwandeln zu können.
.PP
In \s-1GB 18030\s0 kodierte Dateien haben wie Unicode-Dateien eine Markierung der
Bytereihenfolge (\s-1BOM\s0).
.SH "BEISPIELE"
.IX Header "BEISPIELE"
Aus der Standardeingabe lesen und in die Standardausgabe schreiben:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und ersetzen:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
a.txt im ascii-Modus umwandeln und ersetzen, b.txt im 7bit\-Modus umwandeln
und ersetzen:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
a.txt aus dem Mac\- in das Unix-Format umwandeln:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
a.txt aus dem Unix\- in das Mac-Format umwandeln:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
a.txt unter Beibehaltung des ursprünglichen Zeitstempels umwandeln:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und das Ergebnis nach e.txt schreiben, wobei e.txt den
gleichen Zeitstempel erhält wie a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
a.txt umwandeln und ersetzen, b.txt umwandeln und das Ergebnis nach e.txt
schreiben:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
c.txt umwandeln und das Ergebnis nach e.txt schreiben, a.txt umwandeln und
ersetzen, b.txt umwandeln und ersetzen, d.txt umwandeln und das Ergebnis
nach f.txt schreiben:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "REKURSIVE UMWANDLUNG"
.IX Header "REKURSIVE UMWANDLUNG"
Verwenden Sie dos2unix zusammen mit den Befehlen \fIfind\fR\|(1) und \fIxargs\fR\|(1), um
Textdateien in einem Verzeichnisbaum rekursiv umzuwandeln. Um beispielsweise
alle *.txt\-Dateien im aktuellen Verzeichnis und dessen Unterverzeichnissen
umzuwandeln, geben Sie Folgendes ein:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISIERUNG"
.IX Header "LOKALISIERUNG"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Die primäre Sprache wird durch die Umgebungsvariable \s-1LANG\s0 festgelegt. Diese
Variable besteht aus mehreren Teilen: Der erste Teil besteht aus zwei
Kleinbuchstaben, die den Sprachcode angeben. Der zweite Teil ist optional
und bezeichnet den Ländercode in Großbuchstaben, vom davor stehenden
Sprachcode durch einen Unterstrich getrennt. Der dritte Teil ist ebenfalls
optional und gibt die Zeichenkodierung an, vom Ländercode durch einen Punkt
getrennt. Einige Beispiele für Standard-POSIX-Shells:
.Sp
.Vb 7
\& export LANG=de Deutsch
\& export LANG=de_DE Deutsch, Deutschland
\& export LANG=de_AT Deutsch, Österreich
\& export LANG=es_ES Spanisch, Spanien
\& export LANG=es_MX Spanisch, Mexiko
\& export LANG=en_US.iso88591 Englisch, USA, Latin\-1\-Zeichenkodierung
\& export LANG=en_GB.UTF\-8 Englisch, GB, UTF\-8\-Zeichenkodierung
.Ve
.Sp
Eine vollständige Liste der Sprachen und Ländercodes finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Auf Unix-Systemen erhalten Sie mit dem Befehl \fIlocale\fR\|(1) spezifische
Informationen zu den Spracheinstellungen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Mit der Umgebungsvariable \s-1LANGUAGE\s0 können Sie eine Prioritätenliste für
Sprachen übergeben, die Sie durch Doppelpunkte voneinander trennen. Dos2unix
gibt \s-1LANGUAGE\s0 vor \s-1LANG\s0 den Vorzug, zum Beispiel bei Deutsch vor
Niederländisch: \f(CW\*(C`LANGUAGE=de:nl\*(C'\fR. Sie müssen zunächst die Lokalisierung
aktivieren, indem Sie die Variable \s-1LANG \s0(oder \s-1LC_ALL\s0) auf einen anderen Wert
als »C« setzen, bevor Sie die Liste der Sprachprioritäten mit der Variable
\&\s-1LANGUAGE\s0 nutzen können. Weitere Informationen finden Sie im
Gettext-Handbuch:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Falls Sie eine Sprache auswählen, die nicht verfügbar ist, erhalten Sie die
Standardmeldungen in englischer Sprache.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Durch die Umgebungsvariable \s-1DOS2UNIX_LOCALEDIR\s0 wird \s-1LOCALEDIR\s0 während der
Kompilierung übergangen. \s-1LOCALEDIR\s0 wird verwendet, um Sprachdateien zu
finden. Der GNU-Standardwert ist \f(CW\*(C`/usr/local/share/locale\*(C'\fR. Die Option
\&\fB\-\-version\fR zeigt das verwendete \s-1LOCALEDIR\s0 an.
.Sp
Beispiel (POSIX-Shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RÜCKGABEWERT"
.IX Header "RÜCKGABEWERT"
Bei Erfolg wird 0 zurückgegeben. Bei aufgetretenen Systemfehlern wird der
letzte Systemfehler zurückgegeben. Für alle anderen Fehler wird 1
zurückgegeben.
.PP
Der Rückgabewert ist im stillen Modus stets 0, außer wenn fehlerhafte
Befehlszeilenoptionen verwendet werden.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://de.wikipedia.org/wiki/Textdatei>
.PP
<http://de.wikipedia.org/wiki/Wagenr%C3%BCcklauf>
.PP
<http://de.wikipedia.org/wiki/Zeilenumbruch>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTOREN"
.IX Header "AUTOREN"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(Mac2unix\-Modus) \- <wuebben@kde.org>, Christian Wurll (Extra Zeilenumbruch)
\&\- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (Betreuer)
.PP
Projektseite: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-Seite: <http://sourceforge.net/projects/dos2unix/>
.SH "SIEHE AUCH"
.IX Header "SIEHE AUCH"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,764 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOMBRE"
.IX Header "NOMBRE"
dos2unix \- Convertidor de archivos de texto de formato DOS/Mac a Unix y
viceversa
.SH "SINOPSIS"
.IX Header "SINOPSIS"
.Vb 2
\& dos2unix [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
\& unix2dos [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
.Ve
.SH "DESCRIPCIÓN"
.IX Header "DESCRIPCIÓN"
El paquete Dos2unix incluye las herramientas \f(CW\*(C`dos2unix\*(C'\fR y \f(CW\*(C`unix2dos\*(C'\fR para
convertir archivos de texto plano en formato \s-1DOS\s0 o Mac a formato Unix y
viceversa.
.PP
En archivos de texto DOS/Windows, un salto de línea, también conocido como
nueva línea, es una combinación de dos caracteres: un retorno de carro (\s-1CR\s0)
seguido por un salto de línea (\s-1LF\s0). En archivos de texto Unix, un salto de
línea es solamente un carácter: el salto de línea (\s-1LF\s0). En archivos de texto
Mac, antes de Mac \s-1OS X,\s0 un salto de línea era sólo un carácter retorno de
carro (\s-1CR\s0). Actualmente, Mac \s-1OS\s0 usa el estilo Unix de saltos de línea (\s-1LF\s0).
.PP
Además de saltos de línea, Dos2unix puede también convertir la codificación
de archivos. Unas cuantas páginas de códigos \s-1DOS\s0 pueden ser convertidas a
Unix Latin\-1. Y archivos Unicode de Windows (\s-1UTF\-16\s0) pueden ser convertidos
a archivos Unicode de Unix (\s-1UTF\-8\s0).
.PP
Los archivos binarios son ignorados automáticamente, a menos que se fuerce
su conversión.
.PP
Los archivos no regulares, tales como directorios y \s-1FIFO,\s0 son ignorados
automáticamente.
.PP
Los enlaces simbólicos y sus destinos no son modificados por defecto. Los
enlaces simbólicos pueden opcionalmente ser reemplazados, o la salida puede
ser escrita al destino simbólico del enlace. En Windows no está soportada la
escritura a enlaces simbólicos.
.PP
Dos2unix fue modelado después de dos2unix bajo SunOS/Solaris. Hay una
importante diferencia respecto a la versión original SunOS/Solaris. Esta
versión hace, por defecto, la conversión en el mismo archivo (modo de
archivo antiguo), mientras que la versión original de SunOS/Solaris sólo es
compatible con la conversión en archivo emparejado (modo de archivo
nuevo). Véanse las opciones \f(CW\*(C`\-o\*(C'\fR y \f(CW\*(C`\-n\*(C'\fR.
.SH "PARÁMETROS"
.IX Header "PARÁMETROS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Todos los parámetros siguientes son tratados como nombres de archivo. Use
este parámetro si desea convertir archivos cuyos nombres inician con un
guión. Por ejemplo para convertir un archivoo llamado \*(L"\-foo\*(R", use este
comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
O en modo de archivo nuevo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Sólo convierte los salto de línea. Éste es el modo de conversión por
defecto.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversión entre el conjunto de caracteres \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Véase también
la sección \s-1MODOS DE\s0 CONVERSIÓN.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa la página de códigos Windows 1252 (Europa Occidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa la página de códigos \s-1DOS 437 \s0(\s-1EE. UU.\s0). Está es la página de códigos
usada por defecto para conversión \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa la página de códigos \s-1DOS 850 \s0(Europa Occidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa la página de códigos \s-1DOS 860 \s0(Portugués).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa la página de códigos \s-1DOS 863 \s0(Francocanadiense).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa la página de códigos \s-1DOS 865 \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convierte caracteres de 8 bits al espacio de 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantiene la Marca de Orden de Byte (\s-1BOM\s0). Cuando el archivo de entrada
tiene \s-1BOM,\s0 escribe \s-1BOM\s0 en el archivo de salida. Este es el comportamiento
por defecto en la conversión a saltos de línea \s-1DOS.\s0 Vea también la opción
\&\f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Establece el modo de conversión, Donde \s-1CONVMODE\s0 puede ser: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR siendo ascii el valor por defecto.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Fuerza la conversión de archivos binarios.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8,\s0 sin tener
en cuenta la configuración local. Use esta opción para convertir archivos
\&\s-1UTF\-16\s0 a \s-1GB18030.\s0 Esta opción sólo está disponible en Windows.l Véase
también la sección \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Despiega la ayuda y termina el programa.
.IP "\fB\-i[\s-1MARCAS\s0], \-\-info[= \s-1MARCAS\s0] \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-i[MARCAS], --info[= MARCAS] ARCHIVO ..."
Muestra la información del archivo. No se realiza ninguna conversión.
.Sp
Se muestra la siguiente información, en este orden: número de saltos de
línea \s-1DOS,\s0 número de saltos de línea Unix, número de saltos de línea Mac,
Marca de Orden de Byte, de texto o binario, nombre del archivo.
.Sp
Ejemplo de salida:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Se pueden utilizar marcas extras opcionales para modificar la salida. Se
pueden añadir una o más marcas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Muestra el número de saltos de línea \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Muestra el número de saltos de línea Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Muestra el número de saltos de línea Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Muestra la Marca de Orden de Byte.
.IP "\fBt\fR" 4
.IX Item "t"
Muestra si el archivo es de texto o binario.
.IP "\fBc\fR" 4
.IX Item "c"
Muestra sólo los archivos que pueden ser convertidos.
.Sp
Con la marca \f(CW\*(C`c\*(C'\fR dos2unix sólo mostrará los archivos que contengan saltos
de línea \s-1DOS,\s0 unix2dos sólo mostrará los nombres de archivo que tengan
saltos de línea Unix.
.RE
.RS 4
.Sp
Ejemplos:
.Sp
Muestra información para todos los archivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Muestra sólo el número de saltos de línea de \s-1DOS\s0 y de Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Muestra sólo la Marca de Orden de Byte.
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantiene la fecha del archivo de salida igual a la del archivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Muestra la licencia del programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Añade salto de línea adicional.
.Sp
\&\fBdos2unix\fR: Sólo los saltos de línea \s-1DOS\s0 son cambiados por dos saltos de
línea Unix. En modo Mac sólo los saltos de línea Mac son cambiados por dos
saltos de línea Unix.
.Sp
\&\fBunix2dos\fR: Sólo los saltos de línea Unix son cambiados por dos saltos de
línea \s-1DOS.\s0 En modo Mac los saltos de línea Unix son cambiados por dos saltos
de línea Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escribe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de salida. Por
defecto se escribe una \s-1BOM UTF\-8.\s0
.Sp
Cuando el archivo de entrada es \s-1UTF\-16\s0 y se usa la opción \f(CW\*(C`\-u\*(C'\fR, se
escribirá un \s-1BOM UTF\-16.\s0
.Sp
No utilice esta opción cuando la codificación de salida sea distinta de
\&\s-1UTF\-8\s0 o \s-1UTF\-16.\s0 Véase también la sección \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...\s0\fR" 4
.IX Item "-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ..."
Modo de archivo nuevo. Convierte el archivo \s-1ARCHIVO_DE_ENTRADA\s0 y escribe la
salida al archivo \s-1ARCHIVO_DE_SALIDA.\s0 Los nombres de archivo deben ser dados
en pares y los comodines \fIno\fR deben ser usados o \fIperderá\fR sus archivos.
.Sp
La persona que inicia la conversión en el modo de archivo nuevo (emparejado)
será el propietario del archivo convertido. Los permisos de
lectura/escritura del archivo nuevo serán los permisos del archivo original
menos la \fIumask\fR\|(1) de la persona que ejecute la conversión.
.IP "\fB\-o, \-\-oldfile \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARCHIVO ..."
Modo de archivo antiguo. Convierte el archivo \s-1ARCHIVO\s0 y lo sobrescribe con
la salida. El programa por defecto se ejecuta en este modo. Se pueden
emplear comodines.
.Sp
En modo de archivo antiguo (in situ), el archivo convertido tiene el mismo
propietario, grupo y permisos de lectura/escritura que el archivo original.
Lo mismo aplica cuando el archivo es convertido por otro usuario que tiene
permiso de lectura en el archivo (p.e. usuario root). La conversión será
abortada cuando no sea posible preservar los valores originales. Cambiar el
propietario implicaría que el propietario original ya no podrá leer el
archivo. Cambiar el grupo podría ser un riesgo de seguridad, ya que el
archivo podría ser accesible a personas inadecuadas. La preservación del
propietario, grupo, y permisos de lectura/escritura sólo está soportada bajo
Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo silencioso. Suprime todas las advertencias y mensajes. El valor
retornado es cero. Excepto cuando se emplean parámetros incorrectos.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Elimina la Marca de Orden de Byte (\s-1BOM\s0). No escribe el \s-1BOM\s0 en el archivo de
salida. Este es el comportamiento por defecto al convertir a saltos de línea
Unix. Vea también la opción \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora los archivos binarios (por defecto).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantiene la codificación original \s-1UTF\-16\s0 en el archivo de entrada. El
archivo de salida se escribirá con la misma codificación \s-1UTF\-16,\s0 little o
big endian, como el archivo de entrada. Esto impide la transformación a
\&\s-1UTF\-8.\s0 En consecuencia se escribirá un \s-1BOM UTF\-16.\s0 Esta opción se puede
desactivar con la opción \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Se asume que el formato de archivo de entrada es \s-1UTF\-16LE.\s0
.Sp
Cuando existe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de entrada, la
\&\s-1BOM\s0 tiene prioridad sobre esta opción.
.Sp
Cuando se hace una suposición incorrecta (el archivo de entrada no estaba en
formato \s-1UTF\-16LE\s0) y la conversión tiene éxito, obtendrá un archivo \s-1UTF\-8\s0 de
salida con el texto erróneo. La conversión errónea puede deshacerse con
\&\fIiconv\fR\|(1) convirtiendo el archivo \s-1UTF\-8\s0 de salida de vuelta a \s-1UTF\-16LE.\s0 Esto
restaurará el archivo original.
.Sp
El supuesto de \s-1UTF\-16LE\s0 funciona como un \fImodo de conversión\fR. Al cambiar
al modo por defecto \fIascii\fR el supuesto \s-1UTF\-16LE\s0 es deshabilitado.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Se asume que el formato del archivo de entrada es \s-1UTF\-16BE.\s0
.Sp
Esta opción funciona igual que la opción \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Mostrar mensajes detallados. Se muestra información extra acerca de Marcas
de Orden de Bytes (\s-1BOM\s0) y el número de saltos de línea convertidos.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Sigue los enlaces simbólicos y convierte los destinos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Reemplaza los enlaces simbólicos con los archivos convertidos (los archivos
destino originales no se alteran).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
No altera los enlaces simbólicos ni sus destinos (por defecto).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Despiega la información de la versión y termina el programa.
.SH "MODO MAC"
.IX Header "MODO MAC"
En modo normal los saltos de línea son convertidos de \s-1DOS\s0 a Unix y
viceversa. Los saltos de línea Mac no son convertidos.
.PP
En modo Mac los saltos de línea son convertidos de Mac a Unix y
viceversa. Los saltos de línea \s-1DOS\s0 no son modificados.
.PP
Para ejecutar en modo Mac use el modificador \f(CW\*(C`\-c mac\*(C'\fR o use los comandos
\&\f(CW\*(C`mac2unix\*(C'\fR o \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSIÓN"
.IX Header "MODOS DE CONVERSIÓN"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En modo \f(CW\*(C`ascii\*(C'\fR sólo los saltos de línea son convertidos. Éste es el modo
de conversión por defecto.
.Sp
Aunque el nombre de este modo es \s-1ASCII,\s0 que es un estándar de 7 bits, éste
emplea 8 bits. Siempre use este modo cuando convierta archivos Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
En este modo todos los caracteres no \s-1ASCII\s0 de 8 bits (con valores de 128 a
255) son convertidos al espacio de 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Los caracteres son convertidos entre un conjunto de caracteres \s-1DOS \s0(página
de códigos) y el conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latín\-1) de Unix. Los
caracteres \s-1DOS\s0 sin equivalente \s-1ISO\-8859\-1,\s0 para los cuales la conversión es
imposible, son convertidos en un punto. Lo mismo se aplica para caracteres
\&\s-1ISO\-8859\-1\s0 sin contraparte \s-1DOS.\s0
.Sp
Cuando sólo se emplea el parámetro \f(CW\*(C`\-iso\*(C'\fR, dos2unix intentará determinar la
página de códigos activa. Cuando esto no sea posible, dos2unix utilizará la
página de códigos 437 por defecto, la cual es empleada principalmente en
\&\s-1EE. UU.\s0 Para forzar una página de códigos específica emplee los parámetros
\&\f(CW\*(C`\-437\*(C'\fR (\s-1EE. UU.\s0), \f(CW\*(C`\-850\*(C'\fR (Europa Occidental), \f(CW\*(C`\-860\*(C'\fR (Portugués), \f(CW\*(C`\-863\*(C'\fR
(Francocanadiense), o \f(CW\*(C`\-865\*(C'\fR (Nórdico). La página de códigos Windows 1252
(Europa Occidental) también está soportada con el parámetro \f(CW\*(C`\-1252\*(C'\fR. Para
acceder a otras páginas de códigos use dos2unix en combinación con
\&\fIiconv\fR\|(1). Iconv puede convertir entre una larga lista de codificaciones de
caracteres.
.Sp
No use la conversión \s-1ISO\s0 en archivos de texto Unicode. Esto corrompería los
archivos codificados como \s-1UTF\-8.\s0
.Sp
Algunos ejemplos:
.Sp
Convierte de la página de códigos por defecto de \s-1DOS\s0 a Latín\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de \s-1DOS CP850\s0 a Unix Latín\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix \s-1UTF\-8 \s0(Unicode).
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a la página de códigos por defecto de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a Windows \s-1CP1252.\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix \s-1UTF\-8 \s0(Unicode) a Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Véase también <http://czyborra.com/charsets/codepages.html> y
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificaciones"
.IX Subsection "Codificaciones"
Existen diferentes codificaciones Unicode. En Unix y Linux los archivos
Unicode son codificados comúnmente en \s-1UTF\-8.\s0 En Windows los archivos de
texto Unicode pueden estar codificados en \s-1UTF\-8, UTF\-16,\s0 o \s-1UTF\-16\s0 big
endian, pero en general son codificados en formato \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Los archivos de texto Unicode pueden tener saltos de línea \s-1DOS,\s0 Unix o Mac,
como cualquier archivo de texto.
.PP
Todas las versiones de dos2unix y unix2dos pueden convertir archivos
codificados como \s-1UTF\-8,\s0 debido a que \s-1UTF\-8\s0 fue diseñado para
retro-compatibilidad con \s-1ASCII.\s0
.PP
Dos2unix y unix2dos con soporte Unicode \s-1UTF\-16,\s0 pueden leer archivos de
texto codificados como \s-1UTF\-16\s0 little y big endian. Para ver si dos2unix fue
compilado con soporte \s-1UTF\-16\s0 escriba \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
En Unix/Linux los archivos codificados con \s-1UTF\-16\s0 se convierten a la
codificación de caracteres local. Use el comando \fIlocale\fR\|(1) para averiguar la
codificación de caracteres local. Cuando no se puede hacer la conversión se
obtendrá un error de conversión y se omitirá el archivo.
.PP
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8.\s0 Los
archivos de texto forrajeados con \s-1UTF\-8\s0 están soportados tanto en Windows
como en Unix/Linux.
.PP
Las codificaciones \s-1UTF\-16\s0 y \s-1UTF\-8\s0 son totalmente compatibles, no se perderá
ningún texto en la conversión. Cuando ocurre un error de conversión de
\&\s-1UTF\-16\s0 a \s-1UTF\-8,\s0 por ejemplo cuando el archivo de entrada \s-1UTF\-16\s0 contiene un
error, se omitirá el archivo.
.PP
Cuando se usa la opción \f(CW\*(C`\-u\*(C'\fR, el archivo de salida se escribirá en la misma
codificación \s-1UTF\-16\s0 que el archivo de entrada. La opción \f(CW\*(C`\-u\*(C'\fR previene la
conversión a \s-1UTF\-8.\s0
.PP
Dos2unix y unix2dos no tienen la opción de convertir archivos \s-1UTF\-8\s0 a
\&\s-1UTF\-16.\s0
.PP
La conversión en modos \s-1ISO\s0 y 7\-bit no funciona en archivos \s-1UTF\-16.\s0
.SS "Marca de orden de bytes"
.IX Subsection "Marca de orden de bytes"
En Windows los archivos de texto Unicode típicamente tienen una Marca de
Orden de Bytes (\s-1BOM\s0), debido a que muchos programas de Windows (incluyendo
el Bloc de Notas) añaden una \s-1BOM\s0 por defecto. Véase también
<http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29>.
.PP
En Unix los archivos Unicode no suelen tener \s-1BOM.\s0 Se supone que los archivos
de texto son codificados en la codificación local de caracteres.
.PP
Dos2unix sólo puede detectar si un archivo está en formato \s-1UTF\-16\s0 si el
archivo tiene una \s-1BOM.\s0 Cuando un archivo \s-1UTF\-16\s0 no tiene una \s-1BOM,\s0 dos2unix
tratará el archivo como un archivo binario.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Dos2Unix, por defecto, no escribe \s-1BOM\s0 en el archivo de salida. Con la opción
\&\f(CW\*(C`\-b\*(C'\fR Dos2unix escribe el \s-1BOM\s0 cuando el archivo de entrada tiene \s-1BOM.\s0
.PP
Unix2dos escribe \s-1BOM\s0 en el archivo de salida cuando el archivo de entrada
tiene \s-1BOM.\s0 Use la opción \f(CW\*(C`\-r\*(C'\fR para eliminar la \s-1BOM.\s0
.PP
Dos2unix y unix2dos escriben siempre \s-1BOM\s0 cuando se usa la opción \f(CW\*(C`\-m\*(C'\fR.
.SS "Ejemplos Unicode"
.IX Subsection "Ejemplos Unicode"
Convertir de Windows \s-1UTF\-16 \s0(con una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convertir de Windows \s-1UTF\-16LE \s0(sin una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-8\s0 sin una \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 es un estándar del gobierno chino. Todo producto software vendido en
China está obligado por ley a contener un subconjunto del \s-1GB18030\s0
estándar. Véase <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 es totalmente compatible con Unicode y puede considerarse como
formato de transformación Unicode. Como ocurre con \s-1UTF\-8, GB18030\s0 es
compatible con \s-1ASCII. GB18030\s0 también es compatible con la página de códigos
de Windows 936, también conocida como \s-1GBK.\s0
.PP
En Unix/Linux los archivos \s-1UTF\-16\s0 se convierten a \s-1GB18030\s0 cuando la
codificación local se establece en \s-1GB18030.\s0 Tenga en cuenta que esto sólo
funcionará si se establece la ubicación en China. Por ejemplo en una
configuración local English British la conversión \f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0
a \s-1GB18030\s0 no funcionará, pero en una configuración local China
\&\f(CW\*(C`zh_CN.GB18030\*(C'\fR sí lo hará.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Los archivos codificados como \s-1GB18030\s0 pueden tener una Marca de Orden de
Bytes, como ocurre con los archivos Unicode.
.SH "EJEMPLOS"
.IX Header "EJEMPLOS"
Lee la entrada desde 'stdin' y escribe la salida a 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii, convierte y
reemplaza b.txt empleando modo de conversión de 7bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convierte a.txt del formato de Mac a Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convierte a.txt del formato de Unix a Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convierte y reemplaza a.txt manteniendo la fecha del archivo original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de e.txt
igual a la de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt, convierte y
reemplaza b.txt, convierte d.txt y escribe en f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIÓN RECURSIVA"
.IX Header "CONVERSIÓN RECURSIVA"
Use dos2unix en combinación con los comandos \fIfind\fR\|(1) y \fIxargs\fR\|(1) para
convertir recursivamente archivos de texto contenidos en un árbol de
directorios. Por ejemplo para convertir todos los archivos .txt en el árbol
de directorios debajo del directorio actual escriba:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "INTERNACIONALIZACIÓN"
.IX Header "INTERNACIONALIZACIÓN"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
El idioma principal se selecciona con la variable de entorno \s-1LANG.\s0 La
variable \s-1LANG\s0 consiste de varias partes. La primer parte es el código del
idioma en minúsculas. La segunda es opcional y es el código del país en
mayúsculas, precedido por un guión bajo. Existe también una tercera parte
opcional: la codificación de caracteres, precedida por un punto. Unos
cuantos ejemplos para intérpretes de comandos tipo \s-1POSIX\s0 estándar:
.Sp
.Vb 7
\& export LANG=nl Neerlandés
\& export LANG=nl_NL Neerlandés, Países Bajos
\& export LANG=nl_BE Neerlandés, Bélgica
\& export LANG=es_ES Español, España
\& export LANG=es_MX Español, México
\& export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín\-1
\& export LANG=en_GB.UTF\-8 Ingles, Reino Unido, codificación UTF\-8
.Ve
.Sp
Para obtener una lista completa de códigos de idioma y país véase el manual
de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
En sistemas Unix puede emplear el comando \fIlocale\fR\|(1) para obtener información
específica de locale.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Con la variable de entorno \s-1LANGUAGE\s0 puede especificar una lista de prioridad
de los idiomas, separados por dos puntos. Dos2unix da preferencia a \s-1LANGUAGE\s0
sobre \s-1LANG.\s0 Por ejemplo, primero neerlandés y entonces alemán:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Para usar una lista de prioridad de idiomas a través de
la variable \s-1LANGUAGE\s0 tiene que habilitar antes la internacionalización,
asignando un valor distinto de \*(L"C\*(R" a \s-1LANG \s0(o \s-1LC_ALL\s0). Véase también el
manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si selecciona un idioma que no está disponible el programa funcionará en
ingles.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Con la variable de entorno \s-1DOS2UNIX_LOCALEDIR\s0 el \s-1LOCALEDIR\s0 asignado durante
la compilación puede ser modificado. \s-1LOCALEDIR\s0 es usado para encontrar los
archivos de idioma. El valor por defecto de \s-1GNU\s0 es
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. El parámetro \fB\-\-version\fR mostrará el \s-1LOCALEDIR\s0
en uso.
.Sp
Ejemplo (intérprete de comandos \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR DE RETORNO"
.IX Header "VALOR DE RETORNO"
Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un
error del sistema se regresará el último número de error del sistema. Para
otros errores se regresa 1.
.PP
El valor de retorno es siempre cero en modo silencioso, excepto cuando se
emplean parámetros incorrectos.
.SH "ESTÁNDARES"
.IX Header "ESTÁNDARES"
<http://es.wikipedia.org/wiki/Documento_de_texto>
.PP
<http://es.wikipedia.org/wiki/Retorno_de_carro>
.PP
<http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea>
.PP
<http://es.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) \- <wuebben@kde.org>, Christian Wurll (add extra newline) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Página del proyecto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página de SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VÉASE TAMBIÉN"
.IX Header "VÉASE TAMBIÉN"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,764 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOMBRE"
.IX Header "NOMBRE"
dos2unix \- Convertidor de archivos de texto de formato DOS/Mac a Unix y
viceversa
.SH "SINOPSIS"
.IX Header "SINOPSIS"
.Vb 2
\& dos2unix [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
\& unix2dos [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
.Ve
.SH "DESCRIPCIÓN"
.IX Header "DESCRIPCIÓN"
El paquete Dos2unix incluye las herramientas \f(CW\*(C`dos2unix\*(C'\fR y \f(CW\*(C`unix2dos\*(C'\fR para
convertir archivos de texto plano en formato \s-1DOS\s0 o Mac a formato Unix y
viceversa.
.PP
En archivos de texto DOS/Windows, un salto de línea, también conocido como
nueva línea, es una combinación de dos caracteres: un retorno de carro (\s-1CR\s0)
seguido por un salto de línea (\s-1LF\s0). En archivos de texto Unix, un salto de
línea es solamente un carácter: el salto de línea (\s-1LF\s0). En archivos de texto
Mac, antes de Mac \s-1OS X,\s0 un salto de línea era sólo un carácter retorno de
carro (\s-1CR\s0). Actualmente, Mac \s-1OS\s0 usa el estilo Unix de saltos de línea (\s-1LF\s0).
.PP
Además de saltos de línea, Dos2unix puede también convertir la codificación
de archivos. Unas cuantas páginas de códigos \s-1DOS\s0 pueden ser convertidas a
Unix Latin\-1. Y archivos Unicode de Windows (\s-1UTF\-16\s0) pueden ser convertidos
a archivos Unicode de Unix (\s-1UTF\-8\s0).
.PP
Los archivos binarios son ignorados automáticamente, a menos que se fuerce
su conversión.
.PP
Los archivos no regulares, tales como directorios y \s-1FIFO,\s0 son ignorados
automáticamente.
.PP
Los enlaces simbólicos y sus destinos no son modificados por defecto. Los
enlaces simbólicos pueden opcionalmente ser reemplazados, o la salida puede
ser escrita al destino simbólico del enlace. En Windows no está soportada la
escritura a enlaces simbólicos.
.PP
Dos2unix fue modelado después de dos2unix bajo SunOS/Solaris. Hay una
importante diferencia respecto a la versión original SunOS/Solaris. Esta
versión hace, por defecto, la conversión en el mismo archivo (modo de
archivo antiguo), mientras que la versión original de SunOS/Solaris sólo es
compatible con la conversión en archivo emparejado (modo de archivo
nuevo). Véanse las opciones \f(CW\*(C`\-o\*(C'\fR y \f(CW\*(C`\-n\*(C'\fR.
.SH "PARÁMETROS"
.IX Header "PARÁMETROS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Todos los parámetros siguientes son tratados como nombres de archivo. Use
este parámetro si desea convertir archivos cuyos nombres inician con un
guión. Por ejemplo para convertir un archivoo llamado \*(L"\-foo\*(R", use este
comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
O en modo de archivo nuevo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Sólo convierte los salto de línea. Éste es el modo de conversión por
defecto.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversión entre el conjunto de caracteres \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Véase también
la sección \s-1MODOS DE\s0 CONVERSIÓN.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa la página de códigos Windows 1252 (Europa Occidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa la página de códigos \s-1DOS 437 \s0(\s-1EE. UU.\s0). Está es la página de códigos
usada por defecto para conversión \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa la página de códigos \s-1DOS 850 \s0(Europa Occidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa la página de códigos \s-1DOS 860 \s0(Portugués).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa la página de códigos \s-1DOS 863 \s0(Francocanadiense).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa la página de códigos \s-1DOS 865 \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convierte caracteres de 8 bits al espacio de 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantiene la Marca de Orden de Byte (\s-1BOM\s0). Cuando el archivo de entrada
tiene \s-1BOM,\s0 escribe \s-1BOM\s0 en el archivo de salida. Este es el comportamiento
por defecto en la conversión a saltos de línea \s-1DOS.\s0 Vea también la opción
\&\f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Establece el modo de conversión, Donde \s-1CONVMODE\s0 puede ser: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR siendo ascii el valor por defecto.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Fuerza la conversión de archivos binarios.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8,\s0 sin tener
en cuenta la configuración local. Use esta opción para convertir archivos
\&\s-1UTF\-16\s0 a \s-1GB18030.\s0 Esta opción sólo está disponible en Windows.l Véase
también la sección \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Despiega la ayuda y termina el programa.
.IP "\fB\-i[\s-1MARCAS\s0], \-\-info[= \s-1MARCAS\s0] \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-i[MARCAS], --info[= MARCAS] ARCHIVO ..."
Muestra la información del archivo. No se realiza ninguna conversión.
.Sp
Se muestra la siguiente información, en este orden: número de saltos de
línea \s-1DOS,\s0 número de saltos de línea Unix, número de saltos de línea Mac,
Marca de Orden de Byte, de texto o binario, nombre del archivo.
.Sp
Ejemplo de salida:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Se pueden utilizar marcas extras opcionales para modificar la salida. Se
pueden añadir una o más marcas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Muestra el número de saltos de línea \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Muestra el número de saltos de línea Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Muestra el número de saltos de línea Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Muestra la Marca de Orden de Byte.
.IP "\fBt\fR" 4
.IX Item "t"
Muestra si el archivo es de texto o binario.
.IP "\fBc\fR" 4
.IX Item "c"
Muestra sólo los archivos que pueden ser convertidos.
.Sp
Con la marca \f(CW\*(C`c\*(C'\fR dos2unix sólo mostrará los archivos que contengan saltos
de línea \s-1DOS,\s0 unix2dos sólo mostrará los nombres de archivo que tengan
saltos de línea Unix.
.RE
.RS 4
.Sp
Ejemplos:
.Sp
Muestra información para todos los archivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Muestra sólo el número de saltos de línea de \s-1DOS\s0 y de Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Muestra sólo la Marca de Orden de Byte.
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantiene la fecha del archivo de salida igual a la del archivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Muestra la licencia del programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Añade salto de línea adicional.
.Sp
\&\fBdos2unix\fR: Sólo los saltos de línea \s-1DOS\s0 son cambiados por dos saltos de
línea Unix. En modo Mac sólo los saltos de línea Mac son cambiados por dos
saltos de línea Unix.
.Sp
\&\fBunix2dos\fR: Sólo los saltos de línea Unix son cambiados por dos saltos de
línea \s-1DOS.\s0 En modo Mac los saltos de línea Unix son cambiados por dos saltos
de línea Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escribe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de salida. Por
defecto se escribe una \s-1BOM UTF\-8.\s0
.Sp
Cuando el archivo de entrada es \s-1UTF\-16\s0 y se usa la opción \f(CW\*(C`\-u\*(C'\fR, se
escribirá un \s-1BOM UTF\-16.\s0
.Sp
No utilice esta opción cuando la codificación de salida sea distinta de
\&\s-1UTF\-8\s0 o \s-1UTF\-16.\s0 Véase también la sección \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...\s0\fR" 4
.IX Item "-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ..."
Modo de archivo nuevo. Convierte el archivo \s-1ARCHIVO_DE_ENTRADA\s0 y escribe la
salida al archivo \s-1ARCHIVO_DE_SALIDA.\s0 Los nombres de archivo deben ser dados
en pares y los comodines \fIno\fR deben ser usados o \fIperderá\fR sus archivos.
.Sp
La persona que inicia la conversión en el modo de archivo nuevo (emparejado)
será el propietario del archivo convertido. Los permisos de
lectura/escritura del archivo nuevo serán los permisos del archivo original
menos la \fIumask\fR\|(1) de la persona que ejecute la conversión.
.IP "\fB\-o, \-\-oldfile \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARCHIVO ..."
Modo de archivo antiguo. Convierte el archivo \s-1ARCHIVO\s0 y lo sobrescribe con
la salida. El programa por defecto se ejecuta en este modo. Se pueden
emplear comodines.
.Sp
En modo de archivo antiguo (in situ), el archivo convertido tiene el mismo
propietario, grupo y permisos de lectura/escritura que el archivo original.
Lo mismo aplica cuando el archivo es convertido por otro usuario que tiene
permiso de lectura en el archivo (p.e. usuario root). La conversión será
abortada cuando no sea posible preservar los valores originales. Cambiar el
propietario implicaría que el propietario original ya no podrá leer el
archivo. Cambiar el grupo podría ser un riesgo de seguridad, ya que el
archivo podría ser accesible a personas inadecuadas. La preservación del
propietario, grupo, y permisos de lectura/escritura sólo está soportada bajo
Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo silencioso. Suprime todas las advertencias y mensajes. El valor
retornado es cero. Excepto cuando se emplean parámetros incorrectos.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Elimina la Marca de Orden de Byte (\s-1BOM\s0). No escribe el \s-1BOM\s0 en el archivo de
salida. Este es el comportamiento por defecto al convertir a saltos de línea
Unix. Vea también la opción \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora los archivos binarios (por defecto).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantiene la codificación original \s-1UTF\-16\s0 en el archivo de entrada. El
archivo de salida se escribirá con la misma codificación \s-1UTF\-16,\s0 little o
big endian, como el archivo de entrada. Esto impide la transformación a
\&\s-1UTF\-8.\s0 En consecuencia se escribirá un \s-1BOM UTF\-16.\s0 Esta opción se puede
desactivar con la opción \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Se asume que el formato de archivo de entrada es \s-1UTF\-16LE.\s0
.Sp
Cuando existe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de entrada, la
\&\s-1BOM\s0 tiene prioridad sobre esta opción.
.Sp
Cuando se hace una suposición incorrecta (el archivo de entrada no estaba en
formato \s-1UTF\-16LE\s0) y la conversión tiene éxito, obtendrá un archivo \s-1UTF\-8\s0 de
salida con el texto erróneo. La conversión errónea puede deshacerse con
\&\fIiconv\fR\|(1) convirtiendo el archivo \s-1UTF\-8\s0 de salida de vuelta a \s-1UTF\-16LE.\s0 Esto
restaurará el archivo original.
.Sp
El supuesto de \s-1UTF\-16LE\s0 funciona como un \fImodo de conversión\fR. Al cambiar
al modo por defecto \fIascii\fR el supuesto \s-1UTF\-16LE\s0 es deshabilitado.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Se asume que el formato del archivo de entrada es \s-1UTF\-16BE.\s0
.Sp
Esta opción funciona igual que la opción \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Mostrar mensajes detallados. Se muestra información extra acerca de Marcas
de Orden de Bytes (\s-1BOM\s0) y el número de saltos de línea convertidos.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Sigue los enlaces simbólicos y convierte los destinos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Reemplaza los enlaces simbólicos con los archivos convertidos (los archivos
destino originales no se alteran).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
No altera los enlaces simbólicos ni sus destinos (por defecto).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Despiega la información de la versión y termina el programa.
.SH "MODO MAC"
.IX Header "MODO MAC"
En modo normal los saltos de línea son convertidos de \s-1DOS\s0 a Unix y
viceversa. Los saltos de línea Mac no son convertidos.
.PP
En modo Mac los saltos de línea son convertidos de Mac a Unix y
viceversa. Los saltos de línea \s-1DOS\s0 no son modificados.
.PP
Para ejecutar en modo Mac use el modificador \f(CW\*(C`\-c mac\*(C'\fR o use los comandos
\&\f(CW\*(C`mac2unix\*(C'\fR o \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSIÓN"
.IX Header "MODOS DE CONVERSIÓN"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En modo \f(CW\*(C`ascii\*(C'\fR sólo los saltos de línea son convertidos. Éste es el modo
de conversión por defecto.
.Sp
Aunque el nombre de este modo es \s-1ASCII,\s0 que es un estándar de 7 bits, éste
emplea 8 bits. Siempre use este modo cuando convierta archivos Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
En este modo todos los caracteres no \s-1ASCII\s0 de 8 bits (con valores de 128 a
255) son convertidos al espacio de 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Los caracteres son convertidos entre un conjunto de caracteres \s-1DOS \s0(página
de códigos) y el conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latín\-1) de Unix. Los
caracteres \s-1DOS\s0 sin equivalente \s-1ISO\-8859\-1,\s0 para los cuales la conversión es
imposible, son convertidos en un punto. Lo mismo se aplica para caracteres
\&\s-1ISO\-8859\-1\s0 sin contraparte \s-1DOS.\s0
.Sp
Cuando sólo se emplea el parámetro \f(CW\*(C`\-iso\*(C'\fR, dos2unix intentará determinar la
página de códigos activa. Cuando esto no sea posible, dos2unix utilizará la
página de códigos 437 por defecto, la cual es empleada principalmente en
\&\s-1EE. UU.\s0 Para forzar una página de códigos específica emplee los parámetros
\&\f(CW\*(C`\-437\*(C'\fR (\s-1EE. UU.\s0), \f(CW\*(C`\-850\*(C'\fR (Europa Occidental), \f(CW\*(C`\-860\*(C'\fR (Portugués), \f(CW\*(C`\-863\*(C'\fR
(Francocanadiense), o \f(CW\*(C`\-865\*(C'\fR (Nórdico). La página de códigos Windows 1252
(Europa Occidental) también está soportada con el parámetro \f(CW\*(C`\-1252\*(C'\fR. Para
acceder a otras páginas de códigos use dos2unix en combinación con
\&\fIiconv\fR\|(1). Iconv puede convertir entre una larga lista de codificaciones de
caracteres.
.Sp
No use la conversión \s-1ISO\s0 en archivos de texto Unicode. Esto corrompería los
archivos codificados como \s-1UTF\-8.\s0
.Sp
Algunos ejemplos:
.Sp
Convierte de la página de códigos por defecto de \s-1DOS\s0 a Latín\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de \s-1DOS CP850\s0 a Unix Latín\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix \s-1UTF\-8 \s0(Unicode).
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a la página de códigos por defecto de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a Windows \s-1CP1252.\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix \s-1UTF\-8 \s0(Unicode) a Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Véase también <http://czyborra.com/charsets/codepages.html> y
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificaciones"
.IX Subsection "Codificaciones"
Existen diferentes codificaciones Unicode. En Unix y Linux los archivos
Unicode son codificados comúnmente en \s-1UTF\-8.\s0 En Windows los archivos de
texto Unicode pueden estar codificados en \s-1UTF\-8, UTF\-16,\s0 o \s-1UTF\-16\s0 big
endian, pero en general son codificados en formato \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Los archivos de texto Unicode pueden tener saltos de línea \s-1DOS,\s0 Unix o Mac,
como cualquier archivo de texto.
.PP
Todas las versiones de dos2unix y unix2dos pueden convertir archivos
codificados como \s-1UTF\-8,\s0 debido a que \s-1UTF\-8\s0 fue diseñado para
retro-compatibilidad con \s-1ASCII.\s0
.PP
Dos2unix y unix2dos con soporte Unicode \s-1UTF\-16,\s0 pueden leer archivos de
texto codificados como \s-1UTF\-16\s0 little y big endian. Para ver si dos2unix fue
compilado con soporte \s-1UTF\-16\s0 escriba \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
En Unix/Linux los archivos codificados con \s-1UTF\-16\s0 se convierten a la
codificación de caracteres local. Use el comando \fIlocale\fR\|(1) para averiguar la
codificación de caracteres local. Cuando no se puede hacer la conversión se
obtendrá un error de conversión y se omitirá el archivo.
.PP
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8.\s0 Los
archivos de texto forrajeados con \s-1UTF\-8\s0 están soportados tanto en Windows
como en Unix/Linux.
.PP
Las codificaciones \s-1UTF\-16\s0 y \s-1UTF\-8\s0 son totalmente compatibles, no se perderá
ningún texto en la conversión. Cuando ocurre un error de conversión de
\&\s-1UTF\-16\s0 a \s-1UTF\-8,\s0 por ejemplo cuando el archivo de entrada \s-1UTF\-16\s0 contiene un
error, se omitirá el archivo.
.PP
Cuando se usa la opción \f(CW\*(C`\-u\*(C'\fR, el archivo de salida se escribirá en la misma
codificación \s-1UTF\-16\s0 que el archivo de entrada. La opción \f(CW\*(C`\-u\*(C'\fR previene la
conversión a \s-1UTF\-8.\s0
.PP
Dos2unix y unix2dos no tienen la opción de convertir archivos \s-1UTF\-8\s0 a
\&\s-1UTF\-16.\s0
.PP
La conversión en modos \s-1ISO\s0 y 7\-bit no funciona en archivos \s-1UTF\-16.\s0
.SS "Marca de orden de bytes"
.IX Subsection "Marca de orden de bytes"
En Windows los archivos de texto Unicode típicamente tienen una Marca de
Orden de Bytes (\s-1BOM\s0), debido a que muchos programas de Windows (incluyendo
el Bloc de Notas) añaden una \s-1BOM\s0 por defecto. Véase también
<http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29>.
.PP
En Unix los archivos Unicode no suelen tener \s-1BOM.\s0 Se supone que los archivos
de texto son codificados en la codificación local de caracteres.
.PP
Dos2unix sólo puede detectar si un archivo está en formato \s-1UTF\-16\s0 si el
archivo tiene una \s-1BOM.\s0 Cuando un archivo \s-1UTF\-16\s0 no tiene una \s-1BOM,\s0 dos2unix
tratará el archivo como un archivo binario.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Dos2Unix, por defecto, no escribe \s-1BOM\s0 en el archivo de salida. Con la opción
\&\f(CW\*(C`\-b\*(C'\fR Dos2unix escribe el \s-1BOM\s0 cuando el archivo de entrada tiene \s-1BOM.\s0
.PP
Unix2dos escribe \s-1BOM\s0 en el archivo de salida cuando el archivo de entrada
tiene \s-1BOM.\s0 Use la opción \f(CW\*(C`\-r\*(C'\fR para eliminar la \s-1BOM.\s0
.PP
Dos2unix y unix2dos escriben siempre \s-1BOM\s0 cuando se usa la opción \f(CW\*(C`\-m\*(C'\fR.
.SS "Ejemplos Unicode"
.IX Subsection "Ejemplos Unicode"
Convertir de Windows \s-1UTF\-16 \s0(con una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convertir de Windows \s-1UTF\-16LE \s0(sin una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-8\s0 sin una \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 es un estándar del gobierno chino. Todo producto software vendido en
China está obligado por ley a contener un subconjunto del \s-1GB18030\s0
estándar. Véase <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 es totalmente compatible con Unicode y puede considerarse como
formato de transformación Unicode. Como ocurre con \s-1UTF\-8, GB18030\s0 es
compatible con \s-1ASCII. GB18030\s0 también es compatible con la página de códigos
de Windows 936, también conocida como \s-1GBK.\s0
.PP
En Unix/Linux los archivos \s-1UTF\-16\s0 se convierten a \s-1GB18030\s0 cuando la
codificación local se establece en \s-1GB18030.\s0 Tenga en cuenta que esto sólo
funcionará si se establece la ubicación en China. Por ejemplo en una
configuración local English British la conversión \f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0
a \s-1GB18030\s0 no funcionará, pero en una configuración local China
\&\f(CW\*(C`zh_CN.GB18030\*(C'\fR sí lo hará.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Los archivos codificados como \s-1GB18030\s0 pueden tener una Marca de Orden de
Bytes, como ocurre con los archivos Unicode.
.SH "EJEMPLOS"
.IX Header "EJEMPLOS"
Lee la entrada desde 'stdin' y escribe la salida a 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii, convierte y
reemplaza b.txt empleando modo de conversión de 7bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convierte a.txt del formato de Mac a Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convierte a.txt del formato de Unix a Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convierte y reemplaza a.txt manteniendo la fecha del archivo original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de e.txt
igual a la de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt, convierte y
reemplaza b.txt, convierte d.txt y escribe en f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIÓN RECURSIVA"
.IX Header "CONVERSIÓN RECURSIVA"
Use dos2unix en combinación con los comandos \fIfind\fR\|(1) y \fIxargs\fR\|(1) para
convertir recursivamente archivos de texto contenidos en un árbol de
directorios. Por ejemplo para convertir todos los archivos .txt en el árbol
de directorios debajo del directorio actual escriba:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "INTERNACIONALIZACIÓN"
.IX Header "INTERNACIONALIZACIÓN"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
El idioma principal se selecciona con la variable de entorno \s-1LANG.\s0 La
variable \s-1LANG\s0 consiste de varias partes. La primer parte es el código del
idioma en minúsculas. La segunda es opcional y es el código del país en
mayúsculas, precedido por un guión bajo. Existe también una tercera parte
opcional: la codificación de caracteres, precedida por un punto. Unos
cuantos ejemplos para intérpretes de comandos tipo \s-1POSIX\s0 estándar:
.Sp
.Vb 7
\& export LANG=nl Neerlandés
\& export LANG=nl_NL Neerlandés, Países Bajos
\& export LANG=nl_BE Neerlandés, Bélgica
\& export LANG=es_ES Español, España
\& export LANG=es_MX Español, México
\& export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín\-1
\& export LANG=en_GB.UTF\-8 Ingles, Reino Unido, codificación UTF\-8
.Ve
.Sp
Para obtener una lista completa de códigos de idioma y país véase el manual
de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
En sistemas Unix puede emplear el comando \fIlocale\fR\|(1) para obtener información
específica de locale.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Con la variable de entorno \s-1LANGUAGE\s0 puede especificar una lista de prioridad
de los idiomas, separados por dos puntos. Dos2unix da preferencia a \s-1LANGUAGE\s0
sobre \s-1LANG.\s0 Por ejemplo, primero neerlandés y entonces alemán:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Para usar una lista de prioridad de idiomas a través de
la variable \s-1LANGUAGE\s0 tiene que habilitar antes la internacionalización,
asignando un valor distinto de \*(L"C\*(R" a \s-1LANG \s0(o \s-1LC_ALL\s0). Véase también el
manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si selecciona un idioma que no está disponible el programa funcionará en
ingles.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Con la variable de entorno \s-1DOS2UNIX_LOCALEDIR\s0 el \s-1LOCALEDIR\s0 asignado durante
la compilación puede ser modificado. \s-1LOCALEDIR\s0 es usado para encontrar los
archivos de idioma. El valor por defecto de \s-1GNU\s0 es
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. El parámetro \fB\-\-version\fR mostrará el \s-1LOCALEDIR\s0
en uso.
.Sp
Ejemplo (intérprete de comandos \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR DE RETORNO"
.IX Header "VALOR DE RETORNO"
Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un
error del sistema se regresará el último número de error del sistema. Para
otros errores se regresa 1.
.PP
El valor de retorno es siempre cero en modo silencioso, excepto cuando se
emplean parámetros incorrectos.
.SH "ESTÁNDARES"
.IX Header "ESTÁNDARES"
<http://es.wikipedia.org/wiki/Documento_de_texto>
.PP
<http://es.wikipedia.org/wiki/Retorno_de_carro>
.PP
<http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea>
.PP
<http://es.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) \- <wuebben@kde.org>, Christian Wurll (add extra newline) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Página del proyecto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página de SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VÉASE TAMBIÉN"
.IX Header "VÉASE TAMBIÉN"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,764 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOMBRE"
.IX Header "NOMBRE"
dos2unix \- Convertidor de archivos de texto de formato DOS/Mac a Unix y
viceversa
.SH "SINOPSIS"
.IX Header "SINOPSIS"
.Vb 2
\& dos2unix [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
\& unix2dos [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
.Ve
.SH "DESCRIPCIÓN"
.IX Header "DESCRIPCIÓN"
El paquete Dos2unix incluye las herramientas \f(CW\*(C`dos2unix\*(C'\fR y \f(CW\*(C`unix2dos\*(C'\fR para
convertir archivos de texto plano en formato \s-1DOS\s0 o Mac a formato Unix y
viceversa.
.PP
En archivos de texto DOS/Windows, un salto de línea, también conocido como
nueva línea, es una combinación de dos caracteres: un retorno de carro (\s-1CR\s0)
seguido por un salto de línea (\s-1LF\s0). En archivos de texto Unix, un salto de
línea es solamente un carácter: el salto de línea (\s-1LF\s0). En archivos de texto
Mac, antes de Mac \s-1OS X,\s0 un salto de línea era sólo un carácter retorno de
carro (\s-1CR\s0). Actualmente, Mac \s-1OS\s0 usa el estilo Unix de saltos de línea (\s-1LF\s0).
.PP
Además de saltos de línea, Dos2unix puede también convertir la codificación
de archivos. Unas cuantas páginas de códigos \s-1DOS\s0 pueden ser convertidas a
Unix Latin\-1. Y archivos Unicode de Windows (\s-1UTF\-16\s0) pueden ser convertidos
a archivos Unicode de Unix (\s-1UTF\-8\s0).
.PP
Los archivos binarios son ignorados automáticamente, a menos que se fuerce
su conversión.
.PP
Los archivos no regulares, tales como directorios y \s-1FIFO,\s0 son ignorados
automáticamente.
.PP
Los enlaces simbólicos y sus destinos no son modificados por defecto. Los
enlaces simbólicos pueden opcionalmente ser reemplazados, o la salida puede
ser escrita al destino simbólico del enlace. En Windows no está soportada la
escritura a enlaces simbólicos.
.PP
Dos2unix fue modelado después de dos2unix bajo SunOS/Solaris. Hay una
importante diferencia respecto a la versión original SunOS/Solaris. Esta
versión hace, por defecto, la conversión en el mismo archivo (modo de
archivo antiguo), mientras que la versión original de SunOS/Solaris sólo es
compatible con la conversión en archivo emparejado (modo de archivo
nuevo). Véanse las opciones \f(CW\*(C`\-o\*(C'\fR y \f(CW\*(C`\-n\*(C'\fR.
.SH "PARÁMETROS"
.IX Header "PARÁMETROS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Todos los parámetros siguientes son tratados como nombres de archivo. Use
este parámetro si desea convertir archivos cuyos nombres inician con un
guión. Por ejemplo para convertir un archivoo llamado \*(L"\-foo\*(R", use este
comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
O en modo de archivo nuevo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Sólo convierte los salto de línea. Éste es el modo de conversión por
defecto.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversión entre el conjunto de caracteres \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Véase también
la sección \s-1MODOS DE\s0 CONVERSIÓN.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa la página de códigos Windows 1252 (Europa Occidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa la página de códigos \s-1DOS 437 \s0(\s-1EE. UU.\s0). Está es la página de códigos
usada por defecto para conversión \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa la página de códigos \s-1DOS 850 \s0(Europa Occidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa la página de códigos \s-1DOS 860 \s0(Portugués).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa la página de códigos \s-1DOS 863 \s0(Francocanadiense).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa la página de códigos \s-1DOS 865 \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convierte caracteres de 8 bits al espacio de 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantiene la Marca de Orden de Byte (\s-1BOM\s0). Cuando el archivo de entrada
tiene \s-1BOM,\s0 escribe \s-1BOM\s0 en el archivo de salida. Este es el comportamiento
por defecto en la conversión a saltos de línea \s-1DOS.\s0 Vea también la opción
\&\f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Establece el modo de conversión, Donde \s-1CONVMODE\s0 puede ser: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR siendo ascii el valor por defecto.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Fuerza la conversión de archivos binarios.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8,\s0 sin tener
en cuenta la configuración local. Use esta opción para convertir archivos
\&\s-1UTF\-16\s0 a \s-1GB18030.\s0 Esta opción sólo está disponible en Windows.l Véase
también la sección \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Despiega la ayuda y termina el programa.
.IP "\fB\-i[\s-1MARCAS\s0], \-\-info[= \s-1MARCAS\s0] \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-i[MARCAS], --info[= MARCAS] ARCHIVO ..."
Muestra la información del archivo. No se realiza ninguna conversión.
.Sp
Se muestra la siguiente información, en este orden: número de saltos de
línea \s-1DOS,\s0 número de saltos de línea Unix, número de saltos de línea Mac,
Marca de Orden de Byte, de texto o binario, nombre del archivo.
.Sp
Ejemplo de salida:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Se pueden utilizar marcas extras opcionales para modificar la salida. Se
pueden añadir una o más marcas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Muestra el número de saltos de línea \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Muestra el número de saltos de línea Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Muestra el número de saltos de línea Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Muestra la Marca de Orden de Byte.
.IP "\fBt\fR" 4
.IX Item "t"
Muestra si el archivo es de texto o binario.
.IP "\fBc\fR" 4
.IX Item "c"
Muestra sólo los archivos que pueden ser convertidos.
.Sp
Con la marca \f(CW\*(C`c\*(C'\fR dos2unix sólo mostrará los archivos que contengan saltos
de línea \s-1DOS,\s0 unix2dos sólo mostrará los nombres de archivo que tengan
saltos de línea Unix.
.RE
.RS 4
.Sp
Ejemplos:
.Sp
Muestra información para todos los archivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Muestra sólo el número de saltos de línea de \s-1DOS\s0 y de Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Muestra sólo la Marca de Orden de Byte.
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantiene la fecha del archivo de salida igual a la del archivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Muestra la licencia del programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Añade salto de línea adicional.
.Sp
\&\fBdos2unix\fR: Sólo los saltos de línea \s-1DOS\s0 son cambiados por dos saltos de
línea Unix. En modo Mac sólo los saltos de línea Mac son cambiados por dos
saltos de línea Unix.
.Sp
\&\fBunix2dos\fR: Sólo los saltos de línea Unix son cambiados por dos saltos de
línea \s-1DOS.\s0 En modo Mac los saltos de línea Unix son cambiados por dos saltos
de línea Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escribe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de salida. Por
defecto se escribe una \s-1BOM UTF\-8.\s0
.Sp
Cuando el archivo de entrada es \s-1UTF\-16\s0 y se usa la opción \f(CW\*(C`\-u\*(C'\fR, se
escribirá un \s-1BOM UTF\-16.\s0
.Sp
No utilice esta opción cuando la codificación de salida sea distinta de
\&\s-1UTF\-8\s0 o \s-1UTF\-16.\s0 Véase también la sección \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...\s0\fR" 4
.IX Item "-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ..."
Modo de archivo nuevo. Convierte el archivo \s-1ARCHIVO_DE_ENTRADA\s0 y escribe la
salida al archivo \s-1ARCHIVO_DE_SALIDA.\s0 Los nombres de archivo deben ser dados
en pares y los comodines \fIno\fR deben ser usados o \fIperderá\fR sus archivos.
.Sp
La persona que inicia la conversión en el modo de archivo nuevo (emparejado)
será el propietario del archivo convertido. Los permisos de
lectura/escritura del archivo nuevo serán los permisos del archivo original
menos la \fIumask\fR\|(1) de la persona que ejecute la conversión.
.IP "\fB\-o, \-\-oldfile \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARCHIVO ..."
Modo de archivo antiguo. Convierte el archivo \s-1ARCHIVO\s0 y lo sobrescribe con
la salida. El programa por defecto se ejecuta en este modo. Se pueden
emplear comodines.
.Sp
En modo de archivo antiguo (in situ), el archivo convertido tiene el mismo
propietario, grupo y permisos de lectura/escritura que el archivo original.
Lo mismo aplica cuando el archivo es convertido por otro usuario que tiene
permiso de lectura en el archivo (p.e. usuario root). La conversión será
abortada cuando no sea posible preservar los valores originales. Cambiar el
propietario implicaría que el propietario original ya no podrá leer el
archivo. Cambiar el grupo podría ser un riesgo de seguridad, ya que el
archivo podría ser accesible a personas inadecuadas. La preservación del
propietario, grupo, y permisos de lectura/escritura sólo está soportada bajo
Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo silencioso. Suprime todas las advertencias y mensajes. El valor
retornado es cero. Excepto cuando se emplean parámetros incorrectos.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Elimina la Marca de Orden de Byte (\s-1BOM\s0). No escribe el \s-1BOM\s0 en el archivo de
salida. Este es el comportamiento por defecto al convertir a saltos de línea
Unix. Vea también la opción \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora los archivos binarios (por defecto).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantiene la codificación original \s-1UTF\-16\s0 en el archivo de entrada. El
archivo de salida se escribirá con la misma codificación \s-1UTF\-16,\s0 little o
big endian, como el archivo de entrada. Esto impide la transformación a
\&\s-1UTF\-8.\s0 En consecuencia se escribirá un \s-1BOM UTF\-16.\s0 Esta opción se puede
desactivar con la opción \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Se asume que el formato de archivo de entrada es \s-1UTF\-16LE.\s0
.Sp
Cuando existe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de entrada, la
\&\s-1BOM\s0 tiene prioridad sobre esta opción.
.Sp
Cuando se hace una suposición incorrecta (el archivo de entrada no estaba en
formato \s-1UTF\-16LE\s0) y la conversión tiene éxito, obtendrá un archivo \s-1UTF\-8\s0 de
salida con el texto erróneo. La conversión errónea puede deshacerse con
\&\fIiconv\fR\|(1) convirtiendo el archivo \s-1UTF\-8\s0 de salida de vuelta a \s-1UTF\-16LE.\s0 Esto
restaurará el archivo original.
.Sp
El supuesto de \s-1UTF\-16LE\s0 funciona como un \fImodo de conversión\fR. Al cambiar
al modo por defecto \fIascii\fR el supuesto \s-1UTF\-16LE\s0 es deshabilitado.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Se asume que el formato del archivo de entrada es \s-1UTF\-16BE.\s0
.Sp
Esta opción funciona igual que la opción \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Mostrar mensajes detallados. Se muestra información extra acerca de Marcas
de Orden de Bytes (\s-1BOM\s0) y el número de saltos de línea convertidos.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Sigue los enlaces simbólicos y convierte los destinos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Reemplaza los enlaces simbólicos con los archivos convertidos (los archivos
destino originales no se alteran).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
No altera los enlaces simbólicos ni sus destinos (por defecto).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Despiega la información de la versión y termina el programa.
.SH "MODO MAC"
.IX Header "MODO MAC"
En modo normal los saltos de línea son convertidos de \s-1DOS\s0 a Unix y
viceversa. Los saltos de línea Mac no son convertidos.
.PP
En modo Mac los saltos de línea son convertidos de Mac a Unix y
viceversa. Los saltos de línea \s-1DOS\s0 no son modificados.
.PP
Para ejecutar en modo Mac use el modificador \f(CW\*(C`\-c mac\*(C'\fR o use los comandos
\&\f(CW\*(C`mac2unix\*(C'\fR o \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSIÓN"
.IX Header "MODOS DE CONVERSIÓN"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En modo \f(CW\*(C`ascii\*(C'\fR sólo los saltos de línea son convertidos. Éste es el modo
de conversión por defecto.
.Sp
Aunque el nombre de este modo es \s-1ASCII,\s0 que es un estándar de 7 bits, éste
emplea 8 bits. Siempre use este modo cuando convierta archivos Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
En este modo todos los caracteres no \s-1ASCII\s0 de 8 bits (con valores de 128 a
255) son convertidos al espacio de 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Los caracteres son convertidos entre un conjunto de caracteres \s-1DOS \s0(página
de códigos) y el conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latín\-1) de Unix. Los
caracteres \s-1DOS\s0 sin equivalente \s-1ISO\-8859\-1,\s0 para los cuales la conversión es
imposible, son convertidos en un punto. Lo mismo se aplica para caracteres
\&\s-1ISO\-8859\-1\s0 sin contraparte \s-1DOS.\s0
.Sp
Cuando sólo se emplea el parámetro \f(CW\*(C`\-iso\*(C'\fR, dos2unix intentará determinar la
página de códigos activa. Cuando esto no sea posible, dos2unix utilizará la
página de códigos 437 por defecto, la cual es empleada principalmente en
\&\s-1EE. UU.\s0 Para forzar una página de códigos específica emplee los parámetros
\&\f(CW\*(C`\-437\*(C'\fR (\s-1EE. UU.\s0), \f(CW\*(C`\-850\*(C'\fR (Europa Occidental), \f(CW\*(C`\-860\*(C'\fR (Portugués), \f(CW\*(C`\-863\*(C'\fR
(Francocanadiense), o \f(CW\*(C`\-865\*(C'\fR (Nórdico). La página de códigos Windows 1252
(Europa Occidental) también está soportada con el parámetro \f(CW\*(C`\-1252\*(C'\fR. Para
acceder a otras páginas de códigos use dos2unix en combinación con
\&\fIiconv\fR\|(1). Iconv puede convertir entre una larga lista de codificaciones de
caracteres.
.Sp
No use la conversión \s-1ISO\s0 en archivos de texto Unicode. Esto corrompería los
archivos codificados como \s-1UTF\-8.\s0
.Sp
Algunos ejemplos:
.Sp
Convierte de la página de códigos por defecto de \s-1DOS\s0 a Latín\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de \s-1DOS CP850\s0 a Unix Latín\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix \s-1UTF\-8 \s0(Unicode).
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a la página de códigos por defecto de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a Windows \s-1CP1252.\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix \s-1UTF\-8 \s0(Unicode) a Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Véase también <http://czyborra.com/charsets/codepages.html> y
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificaciones"
.IX Subsection "Codificaciones"
Existen diferentes codificaciones Unicode. En Unix y Linux los archivos
Unicode son codificados comúnmente en \s-1UTF\-8.\s0 En Windows los archivos de
texto Unicode pueden estar codificados en \s-1UTF\-8, UTF\-16,\s0 o \s-1UTF\-16\s0 big
endian, pero en general son codificados en formato \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Los archivos de texto Unicode pueden tener saltos de línea \s-1DOS,\s0 Unix o Mac,
como cualquier archivo de texto.
.PP
Todas las versiones de dos2unix y unix2dos pueden convertir archivos
codificados como \s-1UTF\-8,\s0 debido a que \s-1UTF\-8\s0 fue diseñado para
retro-compatibilidad con \s-1ASCII.\s0
.PP
Dos2unix y unix2dos con soporte Unicode \s-1UTF\-16,\s0 pueden leer archivos de
texto codificados como \s-1UTF\-16\s0 little y big endian. Para ver si dos2unix fue
compilado con soporte \s-1UTF\-16\s0 escriba \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
En Unix/Linux los archivos codificados con \s-1UTF\-16\s0 se convierten a la
codificación de caracteres local. Use el comando \fIlocale\fR\|(1) para averiguar la
codificación de caracteres local. Cuando no se puede hacer la conversión se
obtendrá un error de conversión y se omitirá el archivo.
.PP
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8.\s0 Los
archivos de texto forrajeados con \s-1UTF\-8\s0 están soportados tanto en Windows
como en Unix/Linux.
.PP
Las codificaciones \s-1UTF\-16\s0 y \s-1UTF\-8\s0 son totalmente compatibles, no se perderá
ningún texto en la conversión. Cuando ocurre un error de conversión de
\&\s-1UTF\-16\s0 a \s-1UTF\-8,\s0 por ejemplo cuando el archivo de entrada \s-1UTF\-16\s0 contiene un
error, se omitirá el archivo.
.PP
Cuando se usa la opción \f(CW\*(C`\-u\*(C'\fR, el archivo de salida se escribirá en la misma
codificación \s-1UTF\-16\s0 que el archivo de entrada. La opción \f(CW\*(C`\-u\*(C'\fR previene la
conversión a \s-1UTF\-8.\s0
.PP
Dos2unix y unix2dos no tienen la opción de convertir archivos \s-1UTF\-8\s0 a
\&\s-1UTF\-16.\s0
.PP
La conversión en modos \s-1ISO\s0 y 7\-bit no funciona en archivos \s-1UTF\-16.\s0
.SS "Marca de orden de bytes"
.IX Subsection "Marca de orden de bytes"
En Windows los archivos de texto Unicode típicamente tienen una Marca de
Orden de Bytes (\s-1BOM\s0), debido a que muchos programas de Windows (incluyendo
el Bloc de Notas) añaden una \s-1BOM\s0 por defecto. Véase también
<http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29>.
.PP
En Unix los archivos Unicode no suelen tener \s-1BOM.\s0 Se supone que los archivos
de texto son codificados en la codificación local de caracteres.
.PP
Dos2unix sólo puede detectar si un archivo está en formato \s-1UTF\-16\s0 si el
archivo tiene una \s-1BOM.\s0 Cuando un archivo \s-1UTF\-16\s0 no tiene una \s-1BOM,\s0 dos2unix
tratará el archivo como un archivo binario.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Dos2Unix, por defecto, no escribe \s-1BOM\s0 en el archivo de salida. Con la opción
\&\f(CW\*(C`\-b\*(C'\fR Dos2unix escribe el \s-1BOM\s0 cuando el archivo de entrada tiene \s-1BOM.\s0
.PP
Unix2dos escribe \s-1BOM\s0 en el archivo de salida cuando el archivo de entrada
tiene \s-1BOM.\s0 Use la opción \f(CW\*(C`\-r\*(C'\fR para eliminar la \s-1BOM.\s0
.PP
Dos2unix y unix2dos escriben siempre \s-1BOM\s0 cuando se usa la opción \f(CW\*(C`\-m\*(C'\fR.
.SS "Ejemplos Unicode"
.IX Subsection "Ejemplos Unicode"
Convertir de Windows \s-1UTF\-16 \s0(con una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convertir de Windows \s-1UTF\-16LE \s0(sin una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-8\s0 sin una \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 es un estándar del gobierno chino. Todo producto software vendido en
China está obligado por ley a contener un subconjunto del \s-1GB18030\s0
estándar. Véase <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 es totalmente compatible con Unicode y puede considerarse como
formato de transformación Unicode. Como ocurre con \s-1UTF\-8, GB18030\s0 es
compatible con \s-1ASCII. GB18030\s0 también es compatible con la página de códigos
de Windows 936, también conocida como \s-1GBK.\s0
.PP
En Unix/Linux los archivos \s-1UTF\-16\s0 se convierten a \s-1GB18030\s0 cuando la
codificación local se establece en \s-1GB18030.\s0 Tenga en cuenta que esto sólo
funcionará si se establece la ubicación en China. Por ejemplo en una
configuración local English British la conversión \f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0
a \s-1GB18030\s0 no funcionará, pero en una configuración local China
\&\f(CW\*(C`zh_CN.GB18030\*(C'\fR sí lo hará.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Los archivos codificados como \s-1GB18030\s0 pueden tener una Marca de Orden de
Bytes, como ocurre con los archivos Unicode.
.SH "EJEMPLOS"
.IX Header "EJEMPLOS"
Lee la entrada desde 'stdin' y escribe la salida a 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii, convierte y
reemplaza b.txt empleando modo de conversión de 7bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convierte a.txt del formato de Mac a Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convierte a.txt del formato de Unix a Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convierte y reemplaza a.txt manteniendo la fecha del archivo original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de e.txt
igual a la de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt, convierte y
reemplaza b.txt, convierte d.txt y escribe en f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIÓN RECURSIVA"
.IX Header "CONVERSIÓN RECURSIVA"
Use dos2unix en combinación con los comandos \fIfind\fR\|(1) y \fIxargs\fR\|(1) para
convertir recursivamente archivos de texto contenidos en un árbol de
directorios. Por ejemplo para convertir todos los archivos .txt en el árbol
de directorios debajo del directorio actual escriba:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "INTERNACIONALIZACIÓN"
.IX Header "INTERNACIONALIZACIÓN"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
El idioma principal se selecciona con la variable de entorno \s-1LANG.\s0 La
variable \s-1LANG\s0 consiste de varias partes. La primer parte es el código del
idioma en minúsculas. La segunda es opcional y es el código del país en
mayúsculas, precedido por un guión bajo. Existe también una tercera parte
opcional: la codificación de caracteres, precedida por un punto. Unos
cuantos ejemplos para intérpretes de comandos tipo \s-1POSIX\s0 estándar:
.Sp
.Vb 7
\& export LANG=nl Neerlandés
\& export LANG=nl_NL Neerlandés, Países Bajos
\& export LANG=nl_BE Neerlandés, Bélgica
\& export LANG=es_ES Español, España
\& export LANG=es_MX Español, México
\& export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín\-1
\& export LANG=en_GB.UTF\-8 Ingles, Reino Unido, codificación UTF\-8
.Ve
.Sp
Para obtener una lista completa de códigos de idioma y país véase el manual
de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
En sistemas Unix puede emplear el comando \fIlocale\fR\|(1) para obtener información
específica de locale.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Con la variable de entorno \s-1LANGUAGE\s0 puede especificar una lista de prioridad
de los idiomas, separados por dos puntos. Dos2unix da preferencia a \s-1LANGUAGE\s0
sobre \s-1LANG.\s0 Por ejemplo, primero neerlandés y entonces alemán:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Para usar una lista de prioridad de idiomas a través de
la variable \s-1LANGUAGE\s0 tiene que habilitar antes la internacionalización,
asignando un valor distinto de \*(L"C\*(R" a \s-1LANG \s0(o \s-1LC_ALL\s0). Véase también el
manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si selecciona un idioma que no está disponible el programa funcionará en
ingles.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Con la variable de entorno \s-1DOS2UNIX_LOCALEDIR\s0 el \s-1LOCALEDIR\s0 asignado durante
la compilación puede ser modificado. \s-1LOCALEDIR\s0 es usado para encontrar los
archivos de idioma. El valor por defecto de \s-1GNU\s0 es
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. El parámetro \fB\-\-version\fR mostrará el \s-1LOCALEDIR\s0
en uso.
.Sp
Ejemplo (intérprete de comandos \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR DE RETORNO"
.IX Header "VALOR DE RETORNO"
Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un
error del sistema se regresará el último número de error del sistema. Para
otros errores se regresa 1.
.PP
El valor de retorno es siempre cero en modo silencioso, excepto cuando se
emplean parámetros incorrectos.
.SH "ESTÁNDARES"
.IX Header "ESTÁNDARES"
<http://es.wikipedia.org/wiki/Documento_de_texto>
.PP
<http://es.wikipedia.org/wiki/Retorno_de_carro>
.PP
<http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea>
.PP
<http://es.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) \- <wuebben@kde.org>, Christian Wurll (add extra newline) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Página del proyecto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página de SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VÉASE TAMBIÉN"
.IX Header "VÉASE TAMBIÉN"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,764 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOMBRE"
.IX Header "NOMBRE"
dos2unix \- Convertidor de archivos de texto de formato DOS/Mac a Unix y
viceversa
.SH "SINOPSIS"
.IX Header "SINOPSIS"
.Vb 2
\& dos2unix [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
\& unix2dos [parámetros] [ARCHIVO ...] [\-n ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...]
.Ve
.SH "DESCRIPCIÓN"
.IX Header "DESCRIPCIÓN"
El paquete Dos2unix incluye las herramientas \f(CW\*(C`dos2unix\*(C'\fR y \f(CW\*(C`unix2dos\*(C'\fR para
convertir archivos de texto plano en formato \s-1DOS\s0 o Mac a formato Unix y
viceversa.
.PP
En archivos de texto DOS/Windows, un salto de línea, también conocido como
nueva línea, es una combinación de dos caracteres: un retorno de carro (\s-1CR\s0)
seguido por un salto de línea (\s-1LF\s0). En archivos de texto Unix, un salto de
línea es solamente un carácter: el salto de línea (\s-1LF\s0). En archivos de texto
Mac, antes de Mac \s-1OS X,\s0 un salto de línea era sólo un carácter retorno de
carro (\s-1CR\s0). Actualmente, Mac \s-1OS\s0 usa el estilo Unix de saltos de línea (\s-1LF\s0).
.PP
Además de saltos de línea, Dos2unix puede también convertir la codificación
de archivos. Unas cuantas páginas de códigos \s-1DOS\s0 pueden ser convertidas a
Unix Latin\-1. Y archivos Unicode de Windows (\s-1UTF\-16\s0) pueden ser convertidos
a archivos Unicode de Unix (\s-1UTF\-8\s0).
.PP
Los archivos binarios son ignorados automáticamente, a menos que se fuerce
su conversión.
.PP
Los archivos no regulares, tales como directorios y \s-1FIFO,\s0 son ignorados
automáticamente.
.PP
Los enlaces simbólicos y sus destinos no son modificados por defecto. Los
enlaces simbólicos pueden opcionalmente ser reemplazados, o la salida puede
ser escrita al destino simbólico del enlace. En Windows no está soportada la
escritura a enlaces simbólicos.
.PP
Dos2unix fue modelado después de dos2unix bajo SunOS/Solaris. Hay una
importante diferencia respecto a la versión original SunOS/Solaris. Esta
versión hace, por defecto, la conversión en el mismo archivo (modo de
archivo antiguo), mientras que la versión original de SunOS/Solaris sólo es
compatible con la conversión en archivo emparejado (modo de archivo
nuevo). Véanse las opciones \f(CW\*(C`\-o\*(C'\fR y \f(CW\*(C`\-n\*(C'\fR.
.SH "PARÁMETROS"
.IX Header "PARÁMETROS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Todos los parámetros siguientes son tratados como nombres de archivo. Use
este parámetro si desea convertir archivos cuyos nombres inician con un
guión. Por ejemplo para convertir un archivoo llamado \*(L"\-foo\*(R", use este
comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
O en modo de archivo nuevo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Sólo convierte los salto de línea. Éste es el modo de conversión por
defecto.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversión entre el conjunto de caracteres \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Véase también
la sección \s-1MODOS DE\s0 CONVERSIÓN.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa la página de códigos Windows 1252 (Europa Occidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa la página de códigos \s-1DOS 437 \s0(\s-1EE. UU.\s0). Está es la página de códigos
usada por defecto para conversión \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa la página de códigos \s-1DOS 850 \s0(Europa Occidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa la página de códigos \s-1DOS 860 \s0(Portugués).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa la página de códigos \s-1DOS 863 \s0(Francocanadiense).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa la página de códigos \s-1DOS 865 \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convierte caracteres de 8 bits al espacio de 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantiene la Marca de Orden de Byte (\s-1BOM\s0). Cuando el archivo de entrada
tiene \s-1BOM,\s0 escribe \s-1BOM\s0 en el archivo de salida. Este es el comportamiento
por defecto en la conversión a saltos de línea \s-1DOS.\s0 Vea también la opción
\&\f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Establece el modo de conversión, Donde \s-1CONVMODE\s0 puede ser: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR siendo ascii el valor por defecto.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Fuerza la conversión de archivos binarios.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8,\s0 sin tener
en cuenta la configuración local. Use esta opción para convertir archivos
\&\s-1UTF\-16\s0 a \s-1GB18030.\s0 Esta opción sólo está disponible en Windows.l Véase
también la sección \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Despiega la ayuda y termina el programa.
.IP "\fB\-i[\s-1MARCAS\s0], \-\-info[= \s-1MARCAS\s0] \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-i[MARCAS], --info[= MARCAS] ARCHIVO ..."
Muestra la información del archivo. No se realiza ninguna conversión.
.Sp
Se muestra la siguiente información, en este orden: número de saltos de
línea \s-1DOS,\s0 número de saltos de línea Unix, número de saltos de línea Mac,
Marca de Orden de Byte, de texto o binario, nombre del archivo.
.Sp
Ejemplo de salida:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Se pueden utilizar marcas extras opcionales para modificar la salida. Se
pueden añadir una o más marcas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Muestra el número de saltos de línea \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Muestra el número de saltos de línea Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Muestra el número de saltos de línea Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Muestra la Marca de Orden de Byte.
.IP "\fBt\fR" 4
.IX Item "t"
Muestra si el archivo es de texto o binario.
.IP "\fBc\fR" 4
.IX Item "c"
Muestra sólo los archivos que pueden ser convertidos.
.Sp
Con la marca \f(CW\*(C`c\*(C'\fR dos2unix sólo mostrará los archivos que contengan saltos
de línea \s-1DOS,\s0 unix2dos sólo mostrará los nombres de archivo que tengan
saltos de línea Unix.
.RE
.RS 4
.Sp
Ejemplos:
.Sp
Muestra información para todos los archivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Muestra sólo el número de saltos de línea de \s-1DOS\s0 y de Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Muestra sólo la Marca de Orden de Byte.
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Muestra los archivos que tienen saltos de línea Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantiene la fecha del archivo de salida igual a la del archivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Muestra la licencia del programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Añade salto de línea adicional.
.Sp
\&\fBdos2unix\fR: Sólo los saltos de línea \s-1DOS\s0 son cambiados por dos saltos de
línea Unix. En modo Mac sólo los saltos de línea Mac son cambiados por dos
saltos de línea Unix.
.Sp
\&\fBunix2dos\fR: Sólo los saltos de línea Unix son cambiados por dos saltos de
línea \s-1DOS.\s0 En modo Mac los saltos de línea Unix son cambiados por dos saltos
de línea Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escribe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de salida. Por
defecto se escribe una \s-1BOM UTF\-8.\s0
.Sp
Cuando el archivo de entrada es \s-1UTF\-16\s0 y se usa la opción \f(CW\*(C`\-u\*(C'\fR, se
escribirá un \s-1BOM UTF\-16.\s0
.Sp
No utilice esta opción cuando la codificación de salida sea distinta de
\&\s-1UTF\-8\s0 o \s-1UTF\-16.\s0 Véase también la sección \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ...\s0\fR" 4
.IX Item "-n, --newfile ARCHIVO_DE_ENTRADA ARCHIVO_DE_SALIDA ..."
Modo de archivo nuevo. Convierte el archivo \s-1ARCHIVO_DE_ENTRADA\s0 y escribe la
salida al archivo \s-1ARCHIVO_DE_SALIDA.\s0 Los nombres de archivo deben ser dados
en pares y los comodines \fIno\fR deben ser usados o \fIperderá\fR sus archivos.
.Sp
La persona que inicia la conversión en el modo de archivo nuevo (emparejado)
será el propietario del archivo convertido. Los permisos de
lectura/escritura del archivo nuevo serán los permisos del archivo original
menos la \fIumask\fR\|(1) de la persona que ejecute la conversión.
.IP "\fB\-o, \-\-oldfile \s-1ARCHIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARCHIVO ..."
Modo de archivo antiguo. Convierte el archivo \s-1ARCHIVO\s0 y lo sobrescribe con
la salida. El programa por defecto se ejecuta en este modo. Se pueden
emplear comodines.
.Sp
En modo de archivo antiguo (in situ), el archivo convertido tiene el mismo
propietario, grupo y permisos de lectura/escritura que el archivo original.
Lo mismo aplica cuando el archivo es convertido por otro usuario que tiene
permiso de lectura en el archivo (p.e. usuario root). La conversión será
abortada cuando no sea posible preservar los valores originales. Cambiar el
propietario implicaría que el propietario original ya no podrá leer el
archivo. Cambiar el grupo podría ser un riesgo de seguridad, ya que el
archivo podría ser accesible a personas inadecuadas. La preservación del
propietario, grupo, y permisos de lectura/escritura sólo está soportada bajo
Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo silencioso. Suprime todas las advertencias y mensajes. El valor
retornado es cero. Excepto cuando se emplean parámetros incorrectos.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Elimina la Marca de Orden de Byte (\s-1BOM\s0). No escribe el \s-1BOM\s0 en el archivo de
salida. Este es el comportamiento por defecto al convertir a saltos de línea
Unix. Vea también la opción \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora los archivos binarios (por defecto).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantiene la codificación original \s-1UTF\-16\s0 en el archivo de entrada. El
archivo de salida se escribirá con la misma codificación \s-1UTF\-16,\s0 little o
big endian, como el archivo de entrada. Esto impide la transformación a
\&\s-1UTF\-8.\s0 En consecuencia se escribirá un \s-1BOM UTF\-16.\s0 Esta opción se puede
desactivar con la opción \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Se asume que el formato de archivo de entrada es \s-1UTF\-16LE.\s0
.Sp
Cuando existe una Marca de Orden de Bytes (\s-1BOM\s0) en el archivo de entrada, la
\&\s-1BOM\s0 tiene prioridad sobre esta opción.
.Sp
Cuando se hace una suposición incorrecta (el archivo de entrada no estaba en
formato \s-1UTF\-16LE\s0) y la conversión tiene éxito, obtendrá un archivo \s-1UTF\-8\s0 de
salida con el texto erróneo. La conversión errónea puede deshacerse con
\&\fIiconv\fR\|(1) convirtiendo el archivo \s-1UTF\-8\s0 de salida de vuelta a \s-1UTF\-16LE.\s0 Esto
restaurará el archivo original.
.Sp
El supuesto de \s-1UTF\-16LE\s0 funciona como un \fImodo de conversión\fR. Al cambiar
al modo por defecto \fIascii\fR el supuesto \s-1UTF\-16LE\s0 es deshabilitado.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Se asume que el formato del archivo de entrada es \s-1UTF\-16BE.\s0
.Sp
Esta opción funciona igual que la opción \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Mostrar mensajes detallados. Se muestra información extra acerca de Marcas
de Orden de Bytes (\s-1BOM\s0) y el número de saltos de línea convertidos.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Sigue los enlaces simbólicos y convierte los destinos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Reemplaza los enlaces simbólicos con los archivos convertidos (los archivos
destino originales no se alteran).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
No altera los enlaces simbólicos ni sus destinos (por defecto).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Despiega la información de la versión y termina el programa.
.SH "MODO MAC"
.IX Header "MODO MAC"
En modo normal los saltos de línea son convertidos de \s-1DOS\s0 a Unix y
viceversa. Los saltos de línea Mac no son convertidos.
.PP
En modo Mac los saltos de línea son convertidos de Mac a Unix y
viceversa. Los saltos de línea \s-1DOS\s0 no son modificados.
.PP
Para ejecutar en modo Mac use el modificador \f(CW\*(C`\-c mac\*(C'\fR o use los comandos
\&\f(CW\*(C`mac2unix\*(C'\fR o \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSIÓN"
.IX Header "MODOS DE CONVERSIÓN"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En modo \f(CW\*(C`ascii\*(C'\fR sólo los saltos de línea son convertidos. Éste es el modo
de conversión por defecto.
.Sp
Aunque el nombre de este modo es \s-1ASCII,\s0 que es un estándar de 7 bits, éste
emplea 8 bits. Siempre use este modo cuando convierta archivos Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
En este modo todos los caracteres no \s-1ASCII\s0 de 8 bits (con valores de 128 a
255) son convertidos al espacio de 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Los caracteres son convertidos entre un conjunto de caracteres \s-1DOS \s0(página
de códigos) y el conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latín\-1) de Unix. Los
caracteres \s-1DOS\s0 sin equivalente \s-1ISO\-8859\-1,\s0 para los cuales la conversión es
imposible, son convertidos en un punto. Lo mismo se aplica para caracteres
\&\s-1ISO\-8859\-1\s0 sin contraparte \s-1DOS.\s0
.Sp
Cuando sólo se emplea el parámetro \f(CW\*(C`\-iso\*(C'\fR, dos2unix intentará determinar la
página de códigos activa. Cuando esto no sea posible, dos2unix utilizará la
página de códigos 437 por defecto, la cual es empleada principalmente en
\&\s-1EE. UU.\s0 Para forzar una página de códigos específica emplee los parámetros
\&\f(CW\*(C`\-437\*(C'\fR (\s-1EE. UU.\s0), \f(CW\*(C`\-850\*(C'\fR (Europa Occidental), \f(CW\*(C`\-860\*(C'\fR (Portugués), \f(CW\*(C`\-863\*(C'\fR
(Francocanadiense), o \f(CW\*(C`\-865\*(C'\fR (Nórdico). La página de códigos Windows 1252
(Europa Occidental) también está soportada con el parámetro \f(CW\*(C`\-1252\*(C'\fR. Para
acceder a otras páginas de códigos use dos2unix en combinación con
\&\fIiconv\fR\|(1). Iconv puede convertir entre una larga lista de codificaciones de
caracteres.
.Sp
No use la conversión \s-1ISO\s0 en archivos de texto Unicode. Esto corrompería los
archivos codificados como \s-1UTF\-8.\s0
.Sp
Algunos ejemplos:
.Sp
Convierte de la página de códigos por defecto de \s-1DOS\s0 a Latín\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de \s-1DOS CP850\s0 a Unix Latín\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Windows \s-1CP1252\s0 a Unix \s-1UTF\-8 \s0(Unicode).
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a la página de códigos por defecto de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix Latin\-1 a Windows \s-1CP1252.\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convierte de Unix \s-1UTF\-8 \s0(Unicode) a Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Véase también <http://czyborra.com/charsets/codepages.html> y
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificaciones"
.IX Subsection "Codificaciones"
Existen diferentes codificaciones Unicode. En Unix y Linux los archivos
Unicode son codificados comúnmente en \s-1UTF\-8.\s0 En Windows los archivos de
texto Unicode pueden estar codificados en \s-1UTF\-8, UTF\-16,\s0 o \s-1UTF\-16\s0 big
endian, pero en general son codificados en formato \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Los archivos de texto Unicode pueden tener saltos de línea \s-1DOS,\s0 Unix o Mac,
como cualquier archivo de texto.
.PP
Todas las versiones de dos2unix y unix2dos pueden convertir archivos
codificados como \s-1UTF\-8,\s0 debido a que \s-1UTF\-8\s0 fue diseñado para
retro-compatibilidad con \s-1ASCII.\s0
.PP
Dos2unix y unix2dos con soporte Unicode \s-1UTF\-16,\s0 pueden leer archivos de
texto codificados como \s-1UTF\-16\s0 little y big endian. Para ver si dos2unix fue
compilado con soporte \s-1UTF\-16\s0 escriba \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
En Unix/Linux los archivos codificados con \s-1UTF\-16\s0 se convierten a la
codificación de caracteres local. Use el comando \fIlocale\fR\|(1) para averiguar la
codificación de caracteres local. Cuando no se puede hacer la conversión se
obtendrá un error de conversión y se omitirá el archivo.
.PP
En Windows los archivos \s-1UTF\-16\s0 se convierten por defecto a \s-1UTF\-8.\s0 Los
archivos de texto forrajeados con \s-1UTF\-8\s0 están soportados tanto en Windows
como en Unix/Linux.
.PP
Las codificaciones \s-1UTF\-16\s0 y \s-1UTF\-8\s0 son totalmente compatibles, no se perderá
ningún texto en la conversión. Cuando ocurre un error de conversión de
\&\s-1UTF\-16\s0 a \s-1UTF\-8,\s0 por ejemplo cuando el archivo de entrada \s-1UTF\-16\s0 contiene un
error, se omitirá el archivo.
.PP
Cuando se usa la opción \f(CW\*(C`\-u\*(C'\fR, el archivo de salida se escribirá en la misma
codificación \s-1UTF\-16\s0 que el archivo de entrada. La opción \f(CW\*(C`\-u\*(C'\fR previene la
conversión a \s-1UTF\-8.\s0
.PP
Dos2unix y unix2dos no tienen la opción de convertir archivos \s-1UTF\-8\s0 a
\&\s-1UTF\-16.\s0
.PP
La conversión en modos \s-1ISO\s0 y 7\-bit no funciona en archivos \s-1UTF\-16.\s0
.SS "Marca de orden de bytes"
.IX Subsection "Marca de orden de bytes"
En Windows los archivos de texto Unicode típicamente tienen una Marca de
Orden de Bytes (\s-1BOM\s0), debido a que muchos programas de Windows (incluyendo
el Bloc de Notas) añaden una \s-1BOM\s0 por defecto. Véase también
<http://es.wikipedia.org/wiki/Marca_de_orden_de_bytes_%28BOM%29>.
.PP
En Unix los archivos Unicode no suelen tener \s-1BOM.\s0 Se supone que los archivos
de texto son codificados en la codificación local de caracteres.
.PP
Dos2unix sólo puede detectar si un archivo está en formato \s-1UTF\-16\s0 si el
archivo tiene una \s-1BOM.\s0 Cuando un archivo \s-1UTF\-16\s0 no tiene una \s-1BOM,\s0 dos2unix
tratará el archivo como un archivo binario.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Dos2Unix, por defecto, no escribe \s-1BOM\s0 en el archivo de salida. Con la opción
\&\f(CW\*(C`\-b\*(C'\fR Dos2unix escribe el \s-1BOM\s0 cuando el archivo de entrada tiene \s-1BOM.\s0
.PP
Unix2dos escribe \s-1BOM\s0 en el archivo de salida cuando el archivo de entrada
tiene \s-1BOM.\s0 Use la opción \f(CW\*(C`\-r\*(C'\fR para eliminar la \s-1BOM.\s0
.PP
Dos2unix y unix2dos escriben siempre \s-1BOM\s0 cuando se usa la opción \f(CW\*(C`\-m\*(C'\fR.
.SS "Ejemplos Unicode"
.IX Subsection "Ejemplos Unicode"
Convertir de Windows \s-1UTF\-16 \s0(con una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convertir de Windows \s-1UTF\-16LE \s0(sin una \s-1BOM\s0) a Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-8\s0 sin una \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convertir de Unix \s-1UTF\-8\s0 a Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 es un estándar del gobierno chino. Todo producto software vendido en
China está obligado por ley a contener un subconjunto del \s-1GB18030\s0
estándar. Véase <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 es totalmente compatible con Unicode y puede considerarse como
formato de transformación Unicode. Como ocurre con \s-1UTF\-8, GB18030\s0 es
compatible con \s-1ASCII. GB18030\s0 también es compatible con la página de códigos
de Windows 936, también conocida como \s-1GBK.\s0
.PP
En Unix/Linux los archivos \s-1UTF\-16\s0 se convierten a \s-1GB18030\s0 cuando la
codificación local se establece en \s-1GB18030.\s0 Tenga en cuenta que esto sólo
funcionará si se establece la ubicación en China. Por ejemplo en una
configuración local English British la conversión \f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0
a \s-1GB18030\s0 no funcionará, pero en una configuración local China
\&\f(CW\*(C`zh_CN.GB18030\*(C'\fR sí lo hará.
.PP
Use la opción \f(CW\*(C`\-ul\*(C'\fR o \f(CW\*(C`\-ub\*(C'\fR para convertir un archivo \s-1UTF\-16\s0 sin \s-1BOM.\s0
.PP
Los archivos codificados como \s-1GB18030\s0 pueden tener una Marca de Orden de
Bytes, como ocurre con los archivos Unicode.
.SH "EJEMPLOS"
.IX Header "EJEMPLOS"
Lee la entrada desde 'stdin' y escribe la salida a 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convierte y reemplaza a.txt. Convierte y reemplaza b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convierte y reemplaza a.txt empleando modo de conversión ascii, convierte y
reemplaza b.txt empleando modo de conversión de 7bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convierte a.txt del formato de Mac a Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convierte a.txt del formato de Unix a Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convierte y reemplaza a.txt manteniendo la fecha del archivo original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convierte a.txt y escribe la salida en e.txt, manteniendo la fecha de e.txt
igual a la de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convierte y reemplaza a.txt, convierte b.txt y escribe en e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convierte c.txt y escribe en e.txt, convierte y reemplaza a.txt, convierte y
reemplaza b.txt, convierte d.txt y escribe en f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIÓN RECURSIVA"
.IX Header "CONVERSIÓN RECURSIVA"
Use dos2unix en combinación con los comandos \fIfind\fR\|(1) y \fIxargs\fR\|(1) para
convertir recursivamente archivos de texto contenidos en un árbol de
directorios. Por ejemplo para convertir todos los archivos .txt en el árbol
de directorios debajo del directorio actual escriba:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "INTERNACIONALIZACIÓN"
.IX Header "INTERNACIONALIZACIÓN"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
El idioma principal se selecciona con la variable de entorno \s-1LANG.\s0 La
variable \s-1LANG\s0 consiste de varias partes. La primer parte es el código del
idioma en minúsculas. La segunda es opcional y es el código del país en
mayúsculas, precedido por un guión bajo. Existe también una tercera parte
opcional: la codificación de caracteres, precedida por un punto. Unos
cuantos ejemplos para intérpretes de comandos tipo \s-1POSIX\s0 estándar:
.Sp
.Vb 7
\& export LANG=nl Neerlandés
\& export LANG=nl_NL Neerlandés, Países Bajos
\& export LANG=nl_BE Neerlandés, Bélgica
\& export LANG=es_ES Español, España
\& export LANG=es_MX Español, México
\& export LANG=en_US.iso88591 Ingles, EE. UU., codificación Latín\-1
\& export LANG=en_GB.UTF\-8 Ingles, Reino Unido, codificación UTF\-8
.Ve
.Sp
Para obtener una lista completa de códigos de idioma y país véase el manual
de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
En sistemas Unix puede emplear el comando \fIlocale\fR\|(1) para obtener información
específica de locale.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Con la variable de entorno \s-1LANGUAGE\s0 puede especificar una lista de prioridad
de los idiomas, separados por dos puntos. Dos2unix da preferencia a \s-1LANGUAGE\s0
sobre \s-1LANG.\s0 Por ejemplo, primero neerlandés y entonces alemán:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Para usar una lista de prioridad de idiomas a través de
la variable \s-1LANGUAGE\s0 tiene que habilitar antes la internacionalización,
asignando un valor distinto de \*(L"C\*(R" a \s-1LANG \s0(o \s-1LC_ALL\s0). Véase también el
manual de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si selecciona un idioma que no está disponible el programa funcionará en
ingles.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Con la variable de entorno \s-1DOS2UNIX_LOCALEDIR\s0 el \s-1LOCALEDIR\s0 asignado durante
la compilación puede ser modificado. \s-1LOCALEDIR\s0 es usado para encontrar los
archivos de idioma. El valor por defecto de \s-1GNU\s0 es
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. El parámetro \fB\-\-version\fR mostrará el \s-1LOCALEDIR\s0
en uso.
.Sp
Ejemplo (intérprete de comandos \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR DE RETORNO"
.IX Header "VALOR DE RETORNO"
Se regresa cero cuando el programa termina exitosamente. Cuando ocurre un
error del sistema se regresará el último número de error del sistema. Para
otros errores se regresa 1.
.PP
El valor de retorno es siempre cero en modo silencioso, excepto cuando se
emplean parámetros incorrectos.
.SH "ESTÁNDARES"
.IX Header "ESTÁNDARES"
<http://es.wikipedia.org/wiki/Documento_de_texto>
.PP
<http://es.wikipedia.org/wiki/Retorno_de_carro>
.PP
<http://es.wikipedia.org/wiki/Nueva_l%C3%ADnea>
.PP
<http://es.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mac2unix
mode) \- <wuebben@kde.org>, Christian Wurll (add extra newline) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Página del proyecto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página de SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VÉASE TAMBIÉN"
.IX Header "VÉASE TAMBIÉN"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,775 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOM"
.IX Header "NOM"
dos2unix \- Convertit les fichiers textes du format DOS/Mac vers Unix et
inversement
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
\& unix2dos [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Le package Dos2unix inclut les utilitaires \f(CW\*(C`dos2unix\*(C'\fR et \f(CW\*(C`unix2dos\*(C'\fR pour
convertir des fichiers textes au format \s-1DOS\s0 ou Mac vers le format Unix et
inversement.
.PP
Dans les fichiers textes DOS/Windows, un saut de ligne est une combinaison
de deux caractères: un retour de chariot (\s-1CR\s0) suivi d'un saut de ligne
(\s-1LF\s0). Dans les fichiers textes Unix, le saut de ligne est un seul caractère:
le saut de ligne (\s-1LF\s0). Les fichiers textes Mac, avant Mac \s-1OS X,\s0 utilisaient
le retour chariot (\s-1CR\s0) comme seul caractère. De nos jours, Mac \s-1OS\s0 utilise le
même style de saut de ligne que Unix (\s-1LF\s0).
.PP
Outre les sauts de lignes, Dos2unix convertit aussi le codage des
fichiers. Quelques codes page \s-1DOS\s0 peuvent être convertis en Latin\-1 sous
Unix. L'Unicode des fichiers Windows (\s-1UTF\-16\s0) peut être converti en Unicode
Unix (\s-1UTF\-8\s0).
.PP
Les fichiers binaires sont automatiquement ignorés à moins que la conversion
soit forcée.
.PP
Les fichiers non réguliers tels que les répertoires et les FIFOs sont
automatiquement ignorés.
.PP
Les liens symboliques et leur cible sont, par défaut, inchangés. En option,
les liens symboliques peuvent être remplacés ou, au choix, la sortie peut
être écrite dans la cible du lien symbolique. Écrire dans la cible d'un lien
symbolique n'est pas supporté sous Windows.
.PP
Dos2unix a été conçu comme dos2unix sous SunOS/Solaris. Il y a une
différence importante avec la version originale de SunOS/Solaris. Cette
version effectue les conversions en place (ancien mode de fichiers) tandis
que la version originale de SunOS/Solaris ne supporte que la conversion par
paire (nouveau mode de fichier). Voyez aussi les options \f(CW\*(C`\-o\*(C'\fR et \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Traites toutes les options à sa suite comme étant des noms de
fichiers. Utilisez cette option si vous voulez convertir des fichiers dont
le nom commence par un tiret. Par exemple, pour convertir un fichier nommé
« \-foo », vous pouvez utiliser cette commande:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou dans le style des nouveaux fichiers:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo sortie.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convertit uniquement les sauts de lignes. C'est le mode de conversion par
défaut.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Convertit le jeu de caractères du \s-1DOS\s0 vers \s-1ISO\-8859\-1.\s0 Voyez aussi la
section des \s-1MODES DE CONVERSION.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Utilise le code page 1252 de Windows (Europe de l'ouest).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Utilise le code page 437 du \s-1DOS \s0(\s-1US\s0). C'est le code page par défaut pour les
conversions \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Utilise le code page 850 du \s-1DOS \s0(Europe de l'ouest).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Utilise le code page 860 du \s-1DOS \s0(portugais).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Utilise le code page 863 du \s-1DOS \s0(français canadien).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Utilise le code page 865 du \s-1DOS \s0(nordique).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convertit les caractères 8 bits vers l'espace 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Conserve la marque d'ordre des octets (\s-1BOM\s0). Si le fichier d'entrée a une
\&\s-1BOM,\s0 elle est écrite dans le fichier de sortie. C'est le comportement par
défaut quand les sauts de lignes sont convertis au format \s-1DOS.\s0 Consultez
aussi l'option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODE_CONV\s0\fR" 4
.IX Item "-c, --convmode MODE_CONV"
Change le mode de conversion. \s-1MODE_CONV\s0 prend l'une des valeurs: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR. Ascii est la valeur par défaut.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force la conversion de fichiers binaires.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1UTF\-8\s0 par défaut sans
considération pour les paramètres de la localisation. Utilisez cette option
pour convertir \s-1UTF\-16\s0 en \s-1GB18030.\s0 Cette option n'est disponible que sous
Windows. Consultez aussi la section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Affiche l'aide et s'arrête.
.IP "\fB\-i[\s-1FANIONS\s0], \-\-info[=FANIONS] \s-1FICHIER\s0 …\fR" 4
.IX Item "-i[FANIONS], --info[=FANIONS] FICHIER …"
Affiche les informations du fichier. Aucune conversion n'est réalisée.
.Sp
Les informations suivantes sont affichées dans cet ordre: le nombre de sauts
de ligne \s-1DOS,\s0 le nombre de sauts de ligne Unix, le nombre de sauts de ligne
Mac, la marque d'ordre des octets, texte ou binaire, nom du fichier.
.Sp
Exemple de sortie :
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Des fanions facultatifs peuvent être ajoutés pour changer la sortie. Un ou
plusieurs fanions peuvent être ajoutés.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Affiche le nombre de sauts de ligne \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Affiche le nombre de sauts de ligne Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Affiche le nombre de sauts de ligne Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Afficher la marque d'ordre des octets.
.IP "\fBt\fR" 4
.IX Item "t"
Affiche si le fichier est texte ou binaire.
.IP "\fBc\fR" 4
.IX Item "c"
Affiche uniquement les fichiers qui seraient convertis.
.Sp
Avec le fanion \f(CW\*(C`c\*(C'\fR, dos2unix n'affichera que les fichiers contenant des
sauts de ligne \s-1DOS\s0 alors que unix2dos n'affichera que les noms des fichiers
aillant des sauts de ligne Unix.
.RE
.RS 4
.Sp
Exemples:
.Sp
Afficher les informations pour tous les fichier *.txt :
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Afficher uniquement le nombre de sauts de ligne \s-1DOS\s0 et Unix :
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Montrer uniquement la marque d'ordre des octets :
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
La date du fichier de sortie est la même que celle du fichier d'entrée.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Affiche la licence du programme.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Ajoute des sauts de lignes additionnels.
.Sp
\&\fBdos2unix\fR: Seuls les sauts de lignes du \s-1DOS\s0 sont changés en deux sauts de
lignes de Unix. En mode Mac, seuls les sauts de lignes Mac sont changés en
deux sauts de lignes Unix.
.Sp
\&\fBunix2dos\fR: Seuls les sauts de lignes Unix sont changés en deux sauts de
lignes du \s-1DOS.\s0 En mode Mac, les sauts de lignes Unix sont remplacés par deux
sauts de lignes Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Écrit une marque d'ordre des octets (\s-1BOM\s0) dans le fichier de sortie. Par
défaut une \s-1BOM UTF\-8\s0 est écrite.
.Sp
Lorsque le fichier d'entrée est en \s-1UTF\-16\s0 et que l'option \f(CW\*(C`\-u\*(C'\fR est
utilisée, une \s-1BOM UTF\-16\s0 est écrite.
.Sp
N'utilisez jamais cette option quand l'encodage du fichier de sortie n'est
ni \s-1UTF\-8\s0 ni \s-1UTF\-16.\s0 Consultez également la section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newline FICHIER_ENTRÉE \s-1FICHIER_SORTIE\s0 …\fR" 4
.IX Item "-n, --newline FICHIER_ENTRÉE FICHIER_SORTIE …"
Nouveau mode de fichiers. Convertit le fichier FICHER_ENTRÉE et écrit la
sortie dans le fichier \s-1FICHIER_SORTIE.\s0 Les noms des fichiers doivent être
indiqués par paires. Les jokers \fIne\fR doivent \fIpas\fR être utilisés ou vous
\&\fIperdrez\fR vos fichiers.
.Sp
La personne qui démarre la conversion dans le nouveau mode (pairé) des
fichiers sera le propriétaire du fichier converti. Les permissions de
lecture/écriture du nouveau fichier seront les permissions du fichier
original moins le \fIumask\fR\|(1) de la personne qui exécute la conversion.
.IP "\fB\-o, \-\-oldfile \s-1FICHIER\s0 …\fR" 4
.IX Item "-o, --oldfile FICHIER …"
Ancien mode de fichiers. Convertit le fichier \s-1FICHIER\s0 et écrit la sortie
dedans. Le programme fonctionne dans ce mode par défaut. Les jokers peuvent
être utilisés.
.Sp
Dans l'ancien mode (en place) des fichiers, les fichiers convertis ont le
même propriétaire, groupe et permissions lecture/écriture que le fichier
original. Idem quand le fichier est converti par un utilisateur qui a la
permission d'écrire dans le fichier (par exemple, root). La conversion est
interrompue si il n'est pas possible de conserver les valeurs d'origine. Le
changement de propriétaire pourrait signifier que le propriétaire original
n'est plus en mesure de lire le fichier. Le changement de groupe pourrait
être un risque pour la sécurité. Le fichier pourrait être rendu accessible
en lecture par des personnes à qui il n'est pas destiné. La conservation du
propriétaire, du groupe et des permissions de lecture/écriture n'est
supportée que sous Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Mode silencieux. Supprime les avertissements et les messages. La valeur de
sortie est zéro sauf quand de mauvaises options sont utilisées sur la ligne
de commande.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Supprime la marque d'ordre des octets (\s-1BOM\s0). N'écrit pas la \s-1BOM\s0 dans le
fichier de sortie. Ceci est le comportement par défaut lorsque les sauts de
lignes sont convertis au format Unix. Consultez aussi l'option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignore les fichiers binaires (par défaut).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Conserve l'encodage \s-1UTF\-16\s0 original du fichier d'entrée. Le fichier de
sortie sera écrit dans le même encodage \s-1UTF\-16 \s0(petit ou grand boutien) que
le fichier d'entrée. Ceci évite la transformation en \s-1UTF\-8.\s0 Une \s-1BOM UTF\-16\s0
sera écrite en conséquent. Cette option peut être désactivée avec l'option
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Suppose que le fichier d'entrée est au format \s-1UTF\-16LE.\s0
.Sp
Quand il y a un indicateur d'ordre des octets dans le fichier d'entrée,
l'indicateur a priorité sur cette option.
.Sp
Si vous vous êtes trompé sur le format du fichier d'entrée (par exemple, ce
n'était pas un fichier \s-1UTF16\-LE\s0) et que la conversion réussi, vous
obtiendrez un fichier \s-1UTF\-8\s0 contenant le mauvais texte. Vous pouvez
récupérer le fichier original avec \fIiconv\fR\|(1) en convertissant le fichier de
sortie \s-1UTF\-8\s0 vers du \s-1UTF\-16LE.\s0
.Sp
La présupposition de l'\s-1UTF\-16LE\s0 fonctionne comme un \fImode de
conversion\fR. En utilisant le mode \fIascii\fR par défaut, \s-1UTF\-16LE\s0 n'est plus
présupposé.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Suppose que le fichier d'entrée est au format \s-1UTF\-16BE.\s0
.Sp
Cette option fonctionne comme l'option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Affiche des messages verbeux. Des informations supplémentaires sont
affichées à propos des marques d'ordre des octets et du nombre de sauts de
lignes convertis.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Suit les liens symboliques et convertit les cibles.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Remplace les liens symboliques par les fichiers convertis (les fichiers
cibles originaux restent inchangés).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Ne change pas les liens symboliques ni les cibles (par défaut).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Affiche les informations de version puis arrête.
.SH "MODE MAC"
.IX Header "MODE MAC"
En mode normal, les sauts de lignes sont convertis du \s-1DOS\s0 vers Unix et
inversement. Les sauts de lignes Mac ne sont pas convertis.
.PP
En mode Mac, les sauts de lignes sont convertis du format Mac au format Unix
et inversement. Les sauts de lignes \s-1DOS\s0 ne sont pas changés.
.PP
Pour fonctionner en mode Mac, utilisez l'option en ligne de commande \f(CW\*(C`\-c
mac\*(C'\fR ou utilisez les commandes \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODES DE CONVERSION"
.IX Header "MODES DE CONVERSION"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En mode \f(CW\*(C`ascii\*(C'\fR, seuls les sauts de lignes sont convertis. Ceci est le mode
de conversion par défaut.
.Sp
Bien que le nom de ce mode soit \s-1ASCII,\s0 qui est un standard 7 bits, ce mode
travail en réalité sur 8 bits. Utilisez toujours ce mode lorsque vous
convertissez des fichiers Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Dans ce mode, tous les caractères 8 bits non \s-1ASCII \s0(avec des valeurs entre
128 et 255) sont remplacés par une espace 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Les caractères sont convertis entre un jeu de caractères \s-1DOS \s0(code page) et
le jeu de caractères \s-1ISO\-8859\-1 \s0(Latin\-1) de Unix. Les caractères \s-1DOS\s0 sans
équivalent \s-1ISO\-8859\-1,\s0 pour lesquels la conversion n'est pas possible, sont
remplacés par un point. La même chose est valable pour les caractères
\&\s-1ISO\-8859\-1\s0 sans équivalent \s-1DOS.\s0
.Sp
Quand seule l'option \f(CW\*(C`\-iso\*(C'\fR est utilisée, dos2unix essaie de déterminer le
code page actif. Quand ce n'est pas possible, dos2unix utilise le code page
\&\s-1CP437\s0 par défaut qui est surtout utilisé aux \s-1USA.\s0 Pour forcer l'utilisation
d'un code page spécifique, utilisez les options \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR
(Europe de l'ouest), \f(CW\*(C`\-860\*(C'\fR (portugais), \f(CW\*(C`\-863\*(C'\fR (français canadien) ou
\&\f(CW\*(C`\-865\*(C'\fR (nordique). Le code page \s-1CP1252\s0 de Windows (Europe de l'ouest) est
également supporté avec l'option \f(CW\*(C`\-1252\*(C'\fR. Pour d'autres codes pages,
utilisez dos2unix avec \fIiconv\fR\|(1). Iconv supporte une longue liste de codages
de caractères.
.Sp
N'utilisez jamais la conversion \s-1ISO\s0 sur des fichiers textes Unicode. Cela va
corrompre les fichiers encodés en \s-1UTF\-8.\s0
.Sp
Quelques exemples:
.Sp
Convertir du code page par défaut du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP850\s0 du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP1252\s0 de Windows au Latin\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1CP1252\s0 de Windows en \s-1UTF\-8\s0 de Unix (Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrée.txt | dos2unix > sortie.txt
.Ve
.Sp
Convertir du Latin\-1 de Unix au code page par défaut de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP850\s0 du \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1UTF\-8\s0 de Unix (Unicode) en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t CP1252 > sortie.txt
.Ve
.Sp
Consultez aussi <http://czyborra.com/charsets/codepages.html> et
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codages"
.IX Subsection "Codages"
Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers sont
généralement codés en \s-1UTF\-8.\s0 Sous Windows, les fichiers textes Unicode
peuvent être codés en \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 gros boutien mais ils sont
majoritairement codés au format \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Les fichiers textes Unicode peuvent avoir des sauts de lignes \s-1DOS,\s0 Unix ou
Mac, tout comme les fichiers textes normaux.
.PP
Toutes les versions de dos2unix et unix2dos peuvent convertir des fichiers
codés en \s-1UTF\-8\s0 car \s-1UTF\-8\s0 a été conçu pour être rétro\-compatible avec
l'\s-1ASCII.\s0
.PP
Dos2unix et unix2dos, avec le support pour l'Unicode \s-1UTF\-16,\s0 peuvent lire
les fichiers textes codés sous forme petit boutien ou gros boutien. Pour
savoir si dos2unix a été compilé avec le support \s-1UTF\-16\s0 tapez \f(CW\*(C`dos2unix
\&\-V\*(C'\fR.
.PP
Sous Unix/Linux, les fichiers encodés en \s-1UTF\-16\s0 sont convertis vers
l'encodage des caractères de la localisation. Utilisez \fIlocale\fR\|(1) pour
découvrir quel encodage de caractères est utilisé. Lorsque la conversion
n'est pas possible, une erreur de conversion est produite et le fichier est
abandonné.
.PP
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis par défaut en \s-1UTF\-8.\s0 Les
fichiers textes formatés en \s-1UTF\-8\s0 sont bien supportés sous Windows et
Unix/Linux.
.PP
Les codages \s-1UTF\-16\s0 et \s-1UTF\-8\s0 sont parfaitement compatibles. Il n'y a pas de
pertes lors de la conversion. Lorsqu'une erreur de conversion \s-1UTF\-16\s0 vers
\&\s-1UTF\-8\s0 survient, par exemple, quand le fichier d'entrée \s-1UTF\-16\s0 contient une
erreur, le fichier est ignoré.
.PP
Quand l'option \f(CW\*(C`\-u\*(C'\fR est utilisée, le fichier de sortie est écrit dans le
même encodage \s-1UTF\-16\s0 que le fichier d'entrée. L'option \f(CW\*(C`\-u\*(C'\fR empêche la
conversion en \s-1UTF\-8.\s0
.PP
Dos2unix et unix2dos n'ont pas d'option pour convertir des fichiers \s-1UTF\-8\s0 en
\&\s-1UTF\-16.\s0
.PP
Les modes de conversion \s-1ISO\s0 et 7 bits ne fonctionnent pas sur des fichiers
\&\s-1UTF\-16.\s0
.SS "Marque d'ordre des octets"
.IX Subsection "Marque d'ordre des octets"
Les fichiers textes Unicode sous Windows on généralement un indicateur
d'ordre des octets (\s-1BOM\s0) car de nombreux programmes Windows (y compris
Notepad) ajoutent cet indicateur par défaut. Consultez aussi
<http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets>.
.PP
Sous Unix, les fichiers Unicodes n'ont habituellement pas de \s-1BOM.\s0 Il est
supposé que les fichiers textes sont codés selon le codage de
l'environnement linguistique.
.PP
Dos2unix ne peut détecter que le fichier est au format \s-1UTF\-16\s0 si le fichier
n'a pas de \s-1BOM.\s0 Quand le fichier \s-1UTF\-16\s0 n'a pas cet indicateur, dos2unix
voit le fichier comme un fichier binaire.
.PP
Utilisez l'option \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR pour convertir un fichier \s-1UTF\-16\s0 sans
\&\s-1BOM.\s0
.PP
Dos2unix, par défaut, n'écrit pas de \s-1BOM\s0 dans le fichier de sortie. Avec
l'option \f(CW\*(C`\-b\*(C'\fR, Dos2unix écrit une \s-1BOM\s0 quand le fichier d'entrée a une \s-1BOM.\s0
.PP
Unix2dos écrit par défaut une \s-1BOM\s0 dans le fichier de sortie quand le fichier
d'entrée a une \s-1BOM.\s0 Utilisez l'option \f(CW\*(C`\-r\*(C'\fR pour supprimer la \s-1BOM.\s0
.PP
Dos2unix et unix2dos écrivent toujours une \s-1BOM\s0 quand l'option \f(CW\*(C`\-m\*(C'\fR est
utilisée.
.SS "Exemples Unicode"
.IX Subsection "Exemples Unicode"
Convertir de l'\s-1UTF\-16\s0 Windows (avec \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-16LE\s0 de Windows (sans \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-8\s0 de Windows avec \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-16\s0 de Windows:
.PP
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t UTF\-16 > sortie.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 est un standard du gouvernement chinois. Tout logiciel vendu en
Chine doit officiellement supporter un sous ensemble obligatoire du standard
\&\s-1GB18030.\s0 Consultez <http://fr.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 est entièrement compatible avec Unicode et peut être considéré comme
étant un format de transformation unicode. Comme \s-1UTF\-8, GB18030\s0 est
compatible avec \s-1ASCII. GB18030\s0 est aussi compatible avec le code page 936 de
Windows aussi connu comme \s-1GBK.\s0
.PP
Sous Unix/Linux, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1GB18030\s0 quand
l'encodage de la localisation est \s-1GB18030.\s0 Notez que cela ne fonctionnera
que si l'emplacement est en Chine. Autrement dit, dans la localisation
anglaise britannique \f(CW\*(C`en_GB.GB18030\*(C'\fR, la conversion de \s-1UTF\-16\s0 vers \s-1GB18030\s0
ne fonctionnera pas mais une localisation chinoise \f(CW\*(C`zh_CN.GB18030\*(C'\fR
fonctionnera.
.PP
Sous Windows, vous avez besoin de l'option \f(CW\*(C`\-gb\*(C'\fR pour convertir \s-1UTF\-16\s0 en
\&\s-1GB18030.\s0
.PP
Les fichiers encodés en \s-1GB18030\s0 peuvent avoir une marque d'ordre des octets,
comme les fichiers Unicode.
.SH "EXEMPLES"
.IX Header "EXEMPLES"
Lire l'entrée depuis « stdin » et écrire la sortie vers « stdout » :
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convertir et remplacer a.txt. Convertir et remplace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii. Convertir et
remplacer b.txt en mode de conversion 7 bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convertir a.txt depuis le format Mac vers le format Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convertir a.txt du format Unix au format Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convertir et remplacer a.txt tout en conservant la date originale:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt. La date de e.txt est la même que celle
de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convertir et remplacer a.txt. Convertir b.txt et écrire dans e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convertir c.txt et écrire dans e.txt. Convertir et remplacer
a.txt. Convertir et remplacer b.txt. Convertir d.txt et écrire dans f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIONS RÉCURSIVES"
.IX Header "CONVERSIONS RÉCURSIVES"
Utilisez dos2unix avec les commandes \fIfind\fR\|(1) et \fIxargs\fR\|(1) pour convertir
récursivement des fichiers textes dans une arborescence de répertoires. Par
exemple, pour convertir tous les fichiers .txt dans les répertoires sous le
répertoire courant, tapez:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "PARAMÈTRES LINGUISTIQUES"
.IX Header "PARAMÈTRES LINGUISTIQUES"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
La langue principale est sélectionnée par la variable d'environnement
\&\s-1LANG.\s0 La variable \s-1LANG\s0 est composée de plusieurs parties. La première partie
est le code de la langue en minuscules. La deuxième partie est le code du
pays en majuscules précédé d'un souligné. Elle est facultative. Il y a aussi
une troisième partie facultative qui est le codage des caractères précédé
par un point. Voici quelques exemples pour un shell au standard \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=fr Français
\& export LANG=fr_CA Français, Canada
\& export LANG=fr_BE Français, Belgique
\& export LANG=es_ES Espagnol, Espagne
\& export LANG=es_MX Espagnol, Mexique
\& export LANG=en_US.iso88591 Anglais, USA, codage Latin\-1
\& export LANG=en_GB.UTF\-8 Anglais, UK, codage UTF\-8
.Ve
.Sp
La liste complète des codes de langues et de pays est dans le manuel de
gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Sur les systèmes Unix, vous pouvez utiliser la commande \fIlocale\fR\|(1) pour
obtenir des informations sur l'environnement linguistique.
.IP "\fB\s-1LANGUE\s0\fR" 4
.IX Item "LANGUE"
Avec la variable d'environnement \s-1LANGUAGE,\s0 vous pouvez spécifier une liste
de langues prioritaires séparées par des deux-points. Dos2unix fait passer
\&\s-1LANGUAGE\s0 avant \s-1LANG.\s0 Par exemple, pour utiliser le français avant l'anglais:
\&\f(CW\*(C`LANGUAGE=fr:en\*(C'\fR. Vous devez d'abord activer l'environnement linguistique
en assignant une valeur autre que « C » à \s-1LANG \s0(ou \s-1LC_ALL\s0). Ensuite, vous
pourrez utiliser la liste de priorité avec la variable \s-1LANGUAGE.\s0 Voyez
également le manuel de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si vous sélectionnez une langue qui n'est pas disponible, vous obtiendrez
des messages en anglais standard.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Grâce à la variable d'environnement \s-1DOS2UNIX_LOCALEDIR,\s0 la variable
\&\s-1LOCALEDIR\s0 compilée dans l'application peut être remplacée. \s-1LOCALEDIR\s0 est
utilisée pour trouver les fichiers de langue. La valeur par défaut de \s-1GNU\s0
est \f(CW\*(C`/usr/local/share/locale\*(C'\fR. L'option \fB\-\-version\fR affiche la valeur de
\&\s-1LOCALEDIR\s0 utilisée.
.Sp
Exemple (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALEUR DE RETOUR"
.IX Header "VALEUR DE RETOUR"
Zéro est retourné en cas de succès. Si une erreur système se produit, la
dernière erreur système est retournée. Pour les autres erreurs, 1 est
renvoyé.
.PP
La valeur de sortie est toujours zéro en mode silencieux sauf quand de
mauvaises options sont utilisées sur la ligne de commande.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://fr.wikipedia.org/wiki/Fichier_texte>
.PP
<http://fr.wikipedia.org/wiki/Retour_chariot>
.PP
<http://fr.wikipedia.org/wiki/Fin_de_ligne>
.PP
<http://fr.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mode
mac2unix) \- <wuebben@kde.org>, Christian Wurll (ajout de saut de ligne
supplémentaire) \- <wurll@ira.uka.de>, Erwin Waterlander \-
<waterlan@xs4all.nl> (Mainteneur)
.PP
Page du projet: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Page SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VOIR AUSSI"
.IX Header "VOIR AUSSI"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,775 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOM"
.IX Header "NOM"
dos2unix \- Convertit les fichiers textes du format DOS/Mac vers Unix et
inversement
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
\& unix2dos [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Le package Dos2unix inclut les utilitaires \f(CW\*(C`dos2unix\*(C'\fR et \f(CW\*(C`unix2dos\*(C'\fR pour
convertir des fichiers textes au format \s-1DOS\s0 ou Mac vers le format Unix et
inversement.
.PP
Dans les fichiers textes DOS/Windows, un saut de ligne est une combinaison
de deux caractères: un retour de chariot (\s-1CR\s0) suivi d'un saut de ligne
(\s-1LF\s0). Dans les fichiers textes Unix, le saut de ligne est un seul caractère:
le saut de ligne (\s-1LF\s0). Les fichiers textes Mac, avant Mac \s-1OS X,\s0 utilisaient
le retour chariot (\s-1CR\s0) comme seul caractère. De nos jours, Mac \s-1OS\s0 utilise le
même style de saut de ligne que Unix (\s-1LF\s0).
.PP
Outre les sauts de lignes, Dos2unix convertit aussi le codage des
fichiers. Quelques codes page \s-1DOS\s0 peuvent être convertis en Latin\-1 sous
Unix. L'Unicode des fichiers Windows (\s-1UTF\-16\s0) peut être converti en Unicode
Unix (\s-1UTF\-8\s0).
.PP
Les fichiers binaires sont automatiquement ignorés à moins que la conversion
soit forcée.
.PP
Les fichiers non réguliers tels que les répertoires et les FIFOs sont
automatiquement ignorés.
.PP
Les liens symboliques et leur cible sont, par défaut, inchangés. En option,
les liens symboliques peuvent être remplacés ou, au choix, la sortie peut
être écrite dans la cible du lien symbolique. Écrire dans la cible d'un lien
symbolique n'est pas supporté sous Windows.
.PP
Dos2unix a été conçu comme dos2unix sous SunOS/Solaris. Il y a une
différence importante avec la version originale de SunOS/Solaris. Cette
version effectue les conversions en place (ancien mode de fichiers) tandis
que la version originale de SunOS/Solaris ne supporte que la conversion par
paire (nouveau mode de fichier). Voyez aussi les options \f(CW\*(C`\-o\*(C'\fR et \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Traites toutes les options à sa suite comme étant des noms de
fichiers. Utilisez cette option si vous voulez convertir des fichiers dont
le nom commence par un tiret. Par exemple, pour convertir un fichier nommé
« \-foo », vous pouvez utiliser cette commande:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou dans le style des nouveaux fichiers:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo sortie.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convertit uniquement les sauts de lignes. C'est le mode de conversion par
défaut.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Convertit le jeu de caractères du \s-1DOS\s0 vers \s-1ISO\-8859\-1.\s0 Voyez aussi la
section des \s-1MODES DE CONVERSION.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Utilise le code page 1252 de Windows (Europe de l'ouest).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Utilise le code page 437 du \s-1DOS \s0(\s-1US\s0). C'est le code page par défaut pour les
conversions \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Utilise le code page 850 du \s-1DOS \s0(Europe de l'ouest).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Utilise le code page 860 du \s-1DOS \s0(portugais).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Utilise le code page 863 du \s-1DOS \s0(français canadien).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Utilise le code page 865 du \s-1DOS \s0(nordique).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convertit les caractères 8 bits vers l'espace 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Conserve la marque d'ordre des octets (\s-1BOM\s0). Si le fichier d'entrée a une
\&\s-1BOM,\s0 elle est écrite dans le fichier de sortie. C'est le comportement par
défaut quand les sauts de lignes sont convertis au format \s-1DOS.\s0 Consultez
aussi l'option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODE_CONV\s0\fR" 4
.IX Item "-c, --convmode MODE_CONV"
Change le mode de conversion. \s-1MODE_CONV\s0 prend l'une des valeurs: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR. Ascii est la valeur par défaut.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force la conversion de fichiers binaires.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1UTF\-8\s0 par défaut sans
considération pour les paramètres de la localisation. Utilisez cette option
pour convertir \s-1UTF\-16\s0 en \s-1GB18030.\s0 Cette option n'est disponible que sous
Windows. Consultez aussi la section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Affiche l'aide et s'arrête.
.IP "\fB\-i[\s-1FANIONS\s0], \-\-info[=FANIONS] \s-1FICHIER\s0 …\fR" 4
.IX Item "-i[FANIONS], --info[=FANIONS] FICHIER …"
Affiche les informations du fichier. Aucune conversion n'est réalisée.
.Sp
Les informations suivantes sont affichées dans cet ordre: le nombre de sauts
de ligne \s-1DOS,\s0 le nombre de sauts de ligne Unix, le nombre de sauts de ligne
Mac, la marque d'ordre des octets, texte ou binaire, nom du fichier.
.Sp
Exemple de sortie :
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Des fanions facultatifs peuvent être ajoutés pour changer la sortie. Un ou
plusieurs fanions peuvent être ajoutés.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Affiche le nombre de sauts de ligne \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Affiche le nombre de sauts de ligne Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Affiche le nombre de sauts de ligne Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Afficher la marque d'ordre des octets.
.IP "\fBt\fR" 4
.IX Item "t"
Affiche si le fichier est texte ou binaire.
.IP "\fBc\fR" 4
.IX Item "c"
Affiche uniquement les fichiers qui seraient convertis.
.Sp
Avec le fanion \f(CW\*(C`c\*(C'\fR, dos2unix n'affichera que les fichiers contenant des
sauts de ligne \s-1DOS\s0 alors que unix2dos n'affichera que les noms des fichiers
aillant des sauts de ligne Unix.
.RE
.RS 4
.Sp
Exemples:
.Sp
Afficher les informations pour tous les fichier *.txt :
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Afficher uniquement le nombre de sauts de ligne \s-1DOS\s0 et Unix :
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Montrer uniquement la marque d'ordre des octets :
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
La date du fichier de sortie est la même que celle du fichier d'entrée.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Affiche la licence du programme.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Ajoute des sauts de lignes additionnels.
.Sp
\&\fBdos2unix\fR: Seuls les sauts de lignes du \s-1DOS\s0 sont changés en deux sauts de
lignes de Unix. En mode Mac, seuls les sauts de lignes Mac sont changés en
deux sauts de lignes Unix.
.Sp
\&\fBunix2dos\fR: Seuls les sauts de lignes Unix sont changés en deux sauts de
lignes du \s-1DOS.\s0 En mode Mac, les sauts de lignes Unix sont remplacés par deux
sauts de lignes Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Écrit une marque d'ordre des octets (\s-1BOM\s0) dans le fichier de sortie. Par
défaut une \s-1BOM UTF\-8\s0 est écrite.
.Sp
Lorsque le fichier d'entrée est en \s-1UTF\-16\s0 et que l'option \f(CW\*(C`\-u\*(C'\fR est
utilisée, une \s-1BOM UTF\-16\s0 est écrite.
.Sp
N'utilisez jamais cette option quand l'encodage du fichier de sortie n'est
ni \s-1UTF\-8\s0 ni \s-1UTF\-16.\s0 Consultez également la section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newline FICHIER_ENTRÉE \s-1FICHIER_SORTIE\s0 …\fR" 4
.IX Item "-n, --newline FICHIER_ENTRÉE FICHIER_SORTIE …"
Nouveau mode de fichiers. Convertit le fichier FICHER_ENTRÉE et écrit la
sortie dans le fichier \s-1FICHIER_SORTIE.\s0 Les noms des fichiers doivent être
indiqués par paires. Les jokers \fIne\fR doivent \fIpas\fR être utilisés ou vous
\&\fIperdrez\fR vos fichiers.
.Sp
La personne qui démarre la conversion dans le nouveau mode (pairé) des
fichiers sera le propriétaire du fichier converti. Les permissions de
lecture/écriture du nouveau fichier seront les permissions du fichier
original moins le \fIumask\fR\|(1) de la personne qui exécute la conversion.
.IP "\fB\-o, \-\-oldfile \s-1FICHIER\s0 …\fR" 4
.IX Item "-o, --oldfile FICHIER …"
Ancien mode de fichiers. Convertit le fichier \s-1FICHIER\s0 et écrit la sortie
dedans. Le programme fonctionne dans ce mode par défaut. Les jokers peuvent
être utilisés.
.Sp
Dans l'ancien mode (en place) des fichiers, les fichiers convertis ont le
même propriétaire, groupe et permissions lecture/écriture que le fichier
original. Idem quand le fichier est converti par un utilisateur qui a la
permission d'écrire dans le fichier (par exemple, root). La conversion est
interrompue si il n'est pas possible de conserver les valeurs d'origine. Le
changement de propriétaire pourrait signifier que le propriétaire original
n'est plus en mesure de lire le fichier. Le changement de groupe pourrait
être un risque pour la sécurité. Le fichier pourrait être rendu accessible
en lecture par des personnes à qui il n'est pas destiné. La conservation du
propriétaire, du groupe et des permissions de lecture/écriture n'est
supportée que sous Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Mode silencieux. Supprime les avertissements et les messages. La valeur de
sortie est zéro sauf quand de mauvaises options sont utilisées sur la ligne
de commande.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Supprime la marque d'ordre des octets (\s-1BOM\s0). N'écrit pas la \s-1BOM\s0 dans le
fichier de sortie. Ceci est le comportement par défaut lorsque les sauts de
lignes sont convertis au format Unix. Consultez aussi l'option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignore les fichiers binaires (par défaut).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Conserve l'encodage \s-1UTF\-16\s0 original du fichier d'entrée. Le fichier de
sortie sera écrit dans le même encodage \s-1UTF\-16 \s0(petit ou grand boutien) que
le fichier d'entrée. Ceci évite la transformation en \s-1UTF\-8.\s0 Une \s-1BOM UTF\-16\s0
sera écrite en conséquent. Cette option peut être désactivée avec l'option
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Suppose que le fichier d'entrée est au format \s-1UTF\-16LE.\s0
.Sp
Quand il y a un indicateur d'ordre des octets dans le fichier d'entrée,
l'indicateur a priorité sur cette option.
.Sp
Si vous vous êtes trompé sur le format du fichier d'entrée (par exemple, ce
n'était pas un fichier \s-1UTF16\-LE\s0) et que la conversion réussi, vous
obtiendrez un fichier \s-1UTF\-8\s0 contenant le mauvais texte. Vous pouvez
récupérer le fichier original avec \fIiconv\fR\|(1) en convertissant le fichier de
sortie \s-1UTF\-8\s0 vers du \s-1UTF\-16LE.\s0
.Sp
La présupposition de l'\s-1UTF\-16LE\s0 fonctionne comme un \fImode de
conversion\fR. En utilisant le mode \fIascii\fR par défaut, \s-1UTF\-16LE\s0 n'est plus
présupposé.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Suppose que le fichier d'entrée est au format \s-1UTF\-16BE.\s0
.Sp
Cette option fonctionne comme l'option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Affiche des messages verbeux. Des informations supplémentaires sont
affichées à propos des marques d'ordre des octets et du nombre de sauts de
lignes convertis.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Suit les liens symboliques et convertit les cibles.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Remplace les liens symboliques par les fichiers convertis (les fichiers
cibles originaux restent inchangés).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Ne change pas les liens symboliques ni les cibles (par défaut).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Affiche les informations de version puis arrête.
.SH "MODE MAC"
.IX Header "MODE MAC"
En mode normal, les sauts de lignes sont convertis du \s-1DOS\s0 vers Unix et
inversement. Les sauts de lignes Mac ne sont pas convertis.
.PP
En mode Mac, les sauts de lignes sont convertis du format Mac au format Unix
et inversement. Les sauts de lignes \s-1DOS\s0 ne sont pas changés.
.PP
Pour fonctionner en mode Mac, utilisez l'option en ligne de commande \f(CW\*(C`\-c
mac\*(C'\fR ou utilisez les commandes \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODES DE CONVERSION"
.IX Header "MODES DE CONVERSION"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En mode \f(CW\*(C`ascii\*(C'\fR, seuls les sauts de lignes sont convertis. Ceci est le mode
de conversion par défaut.
.Sp
Bien que le nom de ce mode soit \s-1ASCII,\s0 qui est un standard 7 bits, ce mode
travail en réalité sur 8 bits. Utilisez toujours ce mode lorsque vous
convertissez des fichiers Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Dans ce mode, tous les caractères 8 bits non \s-1ASCII \s0(avec des valeurs entre
128 et 255) sont remplacés par une espace 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Les caractères sont convertis entre un jeu de caractères \s-1DOS \s0(code page) et
le jeu de caractères \s-1ISO\-8859\-1 \s0(Latin\-1) de Unix. Les caractères \s-1DOS\s0 sans
équivalent \s-1ISO\-8859\-1,\s0 pour lesquels la conversion n'est pas possible, sont
remplacés par un point. La même chose est valable pour les caractères
\&\s-1ISO\-8859\-1\s0 sans équivalent \s-1DOS.\s0
.Sp
Quand seule l'option \f(CW\*(C`\-iso\*(C'\fR est utilisée, dos2unix essaie de déterminer le
code page actif. Quand ce n'est pas possible, dos2unix utilise le code page
\&\s-1CP437\s0 par défaut qui est surtout utilisé aux \s-1USA.\s0 Pour forcer l'utilisation
d'un code page spécifique, utilisez les options \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR
(Europe de l'ouest), \f(CW\*(C`\-860\*(C'\fR (portugais), \f(CW\*(C`\-863\*(C'\fR (français canadien) ou
\&\f(CW\*(C`\-865\*(C'\fR (nordique). Le code page \s-1CP1252\s0 de Windows (Europe de l'ouest) est
également supporté avec l'option \f(CW\*(C`\-1252\*(C'\fR. Pour d'autres codes pages,
utilisez dos2unix avec \fIiconv\fR\|(1). Iconv supporte une longue liste de codages
de caractères.
.Sp
N'utilisez jamais la conversion \s-1ISO\s0 sur des fichiers textes Unicode. Cela va
corrompre les fichiers encodés en \s-1UTF\-8.\s0
.Sp
Quelques exemples:
.Sp
Convertir du code page par défaut du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP850\s0 du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP1252\s0 de Windows au Latin\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1CP1252\s0 de Windows en \s-1UTF\-8\s0 de Unix (Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrée.txt | dos2unix > sortie.txt
.Ve
.Sp
Convertir du Latin\-1 de Unix au code page par défaut de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP850\s0 du \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1UTF\-8\s0 de Unix (Unicode) en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t CP1252 > sortie.txt
.Ve
.Sp
Consultez aussi <http://czyborra.com/charsets/codepages.html> et
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codages"
.IX Subsection "Codages"
Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers sont
généralement codés en \s-1UTF\-8.\s0 Sous Windows, les fichiers textes Unicode
peuvent être codés en \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 gros boutien mais ils sont
majoritairement codés au format \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Les fichiers textes Unicode peuvent avoir des sauts de lignes \s-1DOS,\s0 Unix ou
Mac, tout comme les fichiers textes normaux.
.PP
Toutes les versions de dos2unix et unix2dos peuvent convertir des fichiers
codés en \s-1UTF\-8\s0 car \s-1UTF\-8\s0 a été conçu pour être rétro\-compatible avec
l'\s-1ASCII.\s0
.PP
Dos2unix et unix2dos, avec le support pour l'Unicode \s-1UTF\-16,\s0 peuvent lire
les fichiers textes codés sous forme petit boutien ou gros boutien. Pour
savoir si dos2unix a été compilé avec le support \s-1UTF\-16\s0 tapez \f(CW\*(C`dos2unix
\&\-V\*(C'\fR.
.PP
Sous Unix/Linux, les fichiers encodés en \s-1UTF\-16\s0 sont convertis vers
l'encodage des caractères de la localisation. Utilisez \fIlocale\fR\|(1) pour
découvrir quel encodage de caractères est utilisé. Lorsque la conversion
n'est pas possible, une erreur de conversion est produite et le fichier est
abandonné.
.PP
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis par défaut en \s-1UTF\-8.\s0 Les
fichiers textes formatés en \s-1UTF\-8\s0 sont bien supportés sous Windows et
Unix/Linux.
.PP
Les codages \s-1UTF\-16\s0 et \s-1UTF\-8\s0 sont parfaitement compatibles. Il n'y a pas de
pertes lors de la conversion. Lorsqu'une erreur de conversion \s-1UTF\-16\s0 vers
\&\s-1UTF\-8\s0 survient, par exemple, quand le fichier d'entrée \s-1UTF\-16\s0 contient une
erreur, le fichier est ignoré.
.PP
Quand l'option \f(CW\*(C`\-u\*(C'\fR est utilisée, le fichier de sortie est écrit dans le
même encodage \s-1UTF\-16\s0 que le fichier d'entrée. L'option \f(CW\*(C`\-u\*(C'\fR empêche la
conversion en \s-1UTF\-8.\s0
.PP
Dos2unix et unix2dos n'ont pas d'option pour convertir des fichiers \s-1UTF\-8\s0 en
\&\s-1UTF\-16.\s0
.PP
Les modes de conversion \s-1ISO\s0 et 7 bits ne fonctionnent pas sur des fichiers
\&\s-1UTF\-16.\s0
.SS "Marque d'ordre des octets"
.IX Subsection "Marque d'ordre des octets"
Les fichiers textes Unicode sous Windows on généralement un indicateur
d'ordre des octets (\s-1BOM\s0) car de nombreux programmes Windows (y compris
Notepad) ajoutent cet indicateur par défaut. Consultez aussi
<http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets>.
.PP
Sous Unix, les fichiers Unicodes n'ont habituellement pas de \s-1BOM.\s0 Il est
supposé que les fichiers textes sont codés selon le codage de
l'environnement linguistique.
.PP
Dos2unix ne peut détecter que le fichier est au format \s-1UTF\-16\s0 si le fichier
n'a pas de \s-1BOM.\s0 Quand le fichier \s-1UTF\-16\s0 n'a pas cet indicateur, dos2unix
voit le fichier comme un fichier binaire.
.PP
Utilisez l'option \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR pour convertir un fichier \s-1UTF\-16\s0 sans
\&\s-1BOM.\s0
.PP
Dos2unix, par défaut, n'écrit pas de \s-1BOM\s0 dans le fichier de sortie. Avec
l'option \f(CW\*(C`\-b\*(C'\fR, Dos2unix écrit une \s-1BOM\s0 quand le fichier d'entrée a une \s-1BOM.\s0
.PP
Unix2dos écrit par défaut une \s-1BOM\s0 dans le fichier de sortie quand le fichier
d'entrée a une \s-1BOM.\s0 Utilisez l'option \f(CW\*(C`\-r\*(C'\fR pour supprimer la \s-1BOM.\s0
.PP
Dos2unix et unix2dos écrivent toujours une \s-1BOM\s0 quand l'option \f(CW\*(C`\-m\*(C'\fR est
utilisée.
.SS "Exemples Unicode"
.IX Subsection "Exemples Unicode"
Convertir de l'\s-1UTF\-16\s0 Windows (avec \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-16LE\s0 de Windows (sans \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-8\s0 de Windows avec \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-16\s0 de Windows:
.PP
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t UTF\-16 > sortie.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 est un standard du gouvernement chinois. Tout logiciel vendu en
Chine doit officiellement supporter un sous ensemble obligatoire du standard
\&\s-1GB18030.\s0 Consultez <http://fr.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 est entièrement compatible avec Unicode et peut être considéré comme
étant un format de transformation unicode. Comme \s-1UTF\-8, GB18030\s0 est
compatible avec \s-1ASCII. GB18030\s0 est aussi compatible avec le code page 936 de
Windows aussi connu comme \s-1GBK.\s0
.PP
Sous Unix/Linux, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1GB18030\s0 quand
l'encodage de la localisation est \s-1GB18030.\s0 Notez que cela ne fonctionnera
que si l'emplacement est en Chine. Autrement dit, dans la localisation
anglaise britannique \f(CW\*(C`en_GB.GB18030\*(C'\fR, la conversion de \s-1UTF\-16\s0 vers \s-1GB18030\s0
ne fonctionnera pas mais une localisation chinoise \f(CW\*(C`zh_CN.GB18030\*(C'\fR
fonctionnera.
.PP
Sous Windows, vous avez besoin de l'option \f(CW\*(C`\-gb\*(C'\fR pour convertir \s-1UTF\-16\s0 en
\&\s-1GB18030.\s0
.PP
Les fichiers encodés en \s-1GB18030\s0 peuvent avoir une marque d'ordre des octets,
comme les fichiers Unicode.
.SH "EXEMPLES"
.IX Header "EXEMPLES"
Lire l'entrée depuis « stdin » et écrire la sortie vers « stdout » :
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convertir et remplacer a.txt. Convertir et remplace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii. Convertir et
remplacer b.txt en mode de conversion 7 bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convertir a.txt depuis le format Mac vers le format Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convertir a.txt du format Unix au format Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convertir et remplacer a.txt tout en conservant la date originale:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt. La date de e.txt est la même que celle
de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convertir et remplacer a.txt. Convertir b.txt et écrire dans e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convertir c.txt et écrire dans e.txt. Convertir et remplacer
a.txt. Convertir et remplacer b.txt. Convertir d.txt et écrire dans f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIONS RÉCURSIVES"
.IX Header "CONVERSIONS RÉCURSIVES"
Utilisez dos2unix avec les commandes \fIfind\fR\|(1) et \fIxargs\fR\|(1) pour convertir
récursivement des fichiers textes dans une arborescence de répertoires. Par
exemple, pour convertir tous les fichiers .txt dans les répertoires sous le
répertoire courant, tapez:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "PARAMÈTRES LINGUISTIQUES"
.IX Header "PARAMÈTRES LINGUISTIQUES"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
La langue principale est sélectionnée par la variable d'environnement
\&\s-1LANG.\s0 La variable \s-1LANG\s0 est composée de plusieurs parties. La première partie
est le code de la langue en minuscules. La deuxième partie est le code du
pays en majuscules précédé d'un souligné. Elle est facultative. Il y a aussi
une troisième partie facultative qui est le codage des caractères précédé
par un point. Voici quelques exemples pour un shell au standard \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=fr Français
\& export LANG=fr_CA Français, Canada
\& export LANG=fr_BE Français, Belgique
\& export LANG=es_ES Espagnol, Espagne
\& export LANG=es_MX Espagnol, Mexique
\& export LANG=en_US.iso88591 Anglais, USA, codage Latin\-1
\& export LANG=en_GB.UTF\-8 Anglais, UK, codage UTF\-8
.Ve
.Sp
La liste complète des codes de langues et de pays est dans le manuel de
gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Sur les systèmes Unix, vous pouvez utiliser la commande \fIlocale\fR\|(1) pour
obtenir des informations sur l'environnement linguistique.
.IP "\fB\s-1LANGUE\s0\fR" 4
.IX Item "LANGUE"
Avec la variable d'environnement \s-1LANGUAGE,\s0 vous pouvez spécifier une liste
de langues prioritaires séparées par des deux-points. Dos2unix fait passer
\&\s-1LANGUAGE\s0 avant \s-1LANG.\s0 Par exemple, pour utiliser le français avant l'anglais:
\&\f(CW\*(C`LANGUAGE=fr:en\*(C'\fR. Vous devez d'abord activer l'environnement linguistique
en assignant une valeur autre que « C » à \s-1LANG \s0(ou \s-1LC_ALL\s0). Ensuite, vous
pourrez utiliser la liste de priorité avec la variable \s-1LANGUAGE.\s0 Voyez
également le manuel de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si vous sélectionnez une langue qui n'est pas disponible, vous obtiendrez
des messages en anglais standard.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Grâce à la variable d'environnement \s-1DOS2UNIX_LOCALEDIR,\s0 la variable
\&\s-1LOCALEDIR\s0 compilée dans l'application peut être remplacée. \s-1LOCALEDIR\s0 est
utilisée pour trouver les fichiers de langue. La valeur par défaut de \s-1GNU\s0
est \f(CW\*(C`/usr/local/share/locale\*(C'\fR. L'option \fB\-\-version\fR affiche la valeur de
\&\s-1LOCALEDIR\s0 utilisée.
.Sp
Exemple (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALEUR DE RETOUR"
.IX Header "VALEUR DE RETOUR"
Zéro est retourné en cas de succès. Si une erreur système se produit, la
dernière erreur système est retournée. Pour les autres erreurs, 1 est
renvoyé.
.PP
La valeur de sortie est toujours zéro en mode silencieux sauf quand de
mauvaises options sont utilisées sur la ligne de commande.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://fr.wikipedia.org/wiki/Fichier_texte>
.PP
<http://fr.wikipedia.org/wiki/Retour_chariot>
.PP
<http://fr.wikipedia.org/wiki/Fin_de_ligne>
.PP
<http://fr.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mode
mac2unix) \- <wuebben@kde.org>, Christian Wurll (ajout de saut de ligne
supplémentaire) \- <wurll@ira.uka.de>, Erwin Waterlander \-
<waterlan@xs4all.nl> (Mainteneur)
.PP
Page du projet: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Page SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VOIR AUSSI"
.IX Header "VOIR AUSSI"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,775 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOM"
.IX Header "NOM"
dos2unix \- Convertit les fichiers textes du format DOS/Mac vers Unix et
inversement
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
\& unix2dos [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Le package Dos2unix inclut les utilitaires \f(CW\*(C`dos2unix\*(C'\fR et \f(CW\*(C`unix2dos\*(C'\fR pour
convertir des fichiers textes au format \s-1DOS\s0 ou Mac vers le format Unix et
inversement.
.PP
Dans les fichiers textes DOS/Windows, un saut de ligne est une combinaison
de deux caractères: un retour de chariot (\s-1CR\s0) suivi d'un saut de ligne
(\s-1LF\s0). Dans les fichiers textes Unix, le saut de ligne est un seul caractère:
le saut de ligne (\s-1LF\s0). Les fichiers textes Mac, avant Mac \s-1OS X,\s0 utilisaient
le retour chariot (\s-1CR\s0) comme seul caractère. De nos jours, Mac \s-1OS\s0 utilise le
même style de saut de ligne que Unix (\s-1LF\s0).
.PP
Outre les sauts de lignes, Dos2unix convertit aussi le codage des
fichiers. Quelques codes page \s-1DOS\s0 peuvent être convertis en Latin\-1 sous
Unix. L'Unicode des fichiers Windows (\s-1UTF\-16\s0) peut être converti en Unicode
Unix (\s-1UTF\-8\s0).
.PP
Les fichiers binaires sont automatiquement ignorés à moins que la conversion
soit forcée.
.PP
Les fichiers non réguliers tels que les répertoires et les FIFOs sont
automatiquement ignorés.
.PP
Les liens symboliques et leur cible sont, par défaut, inchangés. En option,
les liens symboliques peuvent être remplacés ou, au choix, la sortie peut
être écrite dans la cible du lien symbolique. Écrire dans la cible d'un lien
symbolique n'est pas supporté sous Windows.
.PP
Dos2unix a été conçu comme dos2unix sous SunOS/Solaris. Il y a une
différence importante avec la version originale de SunOS/Solaris. Cette
version effectue les conversions en place (ancien mode de fichiers) tandis
que la version originale de SunOS/Solaris ne supporte que la conversion par
paire (nouveau mode de fichier). Voyez aussi les options \f(CW\*(C`\-o\*(C'\fR et \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Traites toutes les options à sa suite comme étant des noms de
fichiers. Utilisez cette option si vous voulez convertir des fichiers dont
le nom commence par un tiret. Par exemple, pour convertir un fichier nommé
« \-foo », vous pouvez utiliser cette commande:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou dans le style des nouveaux fichiers:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo sortie.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convertit uniquement les sauts de lignes. C'est le mode de conversion par
défaut.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Convertit le jeu de caractères du \s-1DOS\s0 vers \s-1ISO\-8859\-1.\s0 Voyez aussi la
section des \s-1MODES DE CONVERSION.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Utilise le code page 1252 de Windows (Europe de l'ouest).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Utilise le code page 437 du \s-1DOS \s0(\s-1US\s0). C'est le code page par défaut pour les
conversions \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Utilise le code page 850 du \s-1DOS \s0(Europe de l'ouest).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Utilise le code page 860 du \s-1DOS \s0(portugais).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Utilise le code page 863 du \s-1DOS \s0(français canadien).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Utilise le code page 865 du \s-1DOS \s0(nordique).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convertit les caractères 8 bits vers l'espace 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Conserve la marque d'ordre des octets (\s-1BOM\s0). Si le fichier d'entrée a une
\&\s-1BOM,\s0 elle est écrite dans le fichier de sortie. C'est le comportement par
défaut quand les sauts de lignes sont convertis au format \s-1DOS.\s0 Consultez
aussi l'option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODE_CONV\s0\fR" 4
.IX Item "-c, --convmode MODE_CONV"
Change le mode de conversion. \s-1MODE_CONV\s0 prend l'une des valeurs: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR. Ascii est la valeur par défaut.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force la conversion de fichiers binaires.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1UTF\-8\s0 par défaut sans
considération pour les paramètres de la localisation. Utilisez cette option
pour convertir \s-1UTF\-16\s0 en \s-1GB18030.\s0 Cette option n'est disponible que sous
Windows. Consultez aussi la section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Affiche l'aide et s'arrête.
.IP "\fB\-i[\s-1FANIONS\s0], \-\-info[=FANIONS] \s-1FICHIER\s0 …\fR" 4
.IX Item "-i[FANIONS], --info[=FANIONS] FICHIER …"
Affiche les informations du fichier. Aucune conversion n'est réalisée.
.Sp
Les informations suivantes sont affichées dans cet ordre: le nombre de sauts
de ligne \s-1DOS,\s0 le nombre de sauts de ligne Unix, le nombre de sauts de ligne
Mac, la marque d'ordre des octets, texte ou binaire, nom du fichier.
.Sp
Exemple de sortie :
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Des fanions facultatifs peuvent être ajoutés pour changer la sortie. Un ou
plusieurs fanions peuvent être ajoutés.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Affiche le nombre de sauts de ligne \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Affiche le nombre de sauts de ligne Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Affiche le nombre de sauts de ligne Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Afficher la marque d'ordre des octets.
.IP "\fBt\fR" 4
.IX Item "t"
Affiche si le fichier est texte ou binaire.
.IP "\fBc\fR" 4
.IX Item "c"
Affiche uniquement les fichiers qui seraient convertis.
.Sp
Avec le fanion \f(CW\*(C`c\*(C'\fR, dos2unix n'affichera que les fichiers contenant des
sauts de ligne \s-1DOS\s0 alors que unix2dos n'affichera que les noms des fichiers
aillant des sauts de ligne Unix.
.RE
.RS 4
.Sp
Exemples:
.Sp
Afficher les informations pour tous les fichier *.txt :
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Afficher uniquement le nombre de sauts de ligne \s-1DOS\s0 et Unix :
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Montrer uniquement la marque d'ordre des octets :
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
La date du fichier de sortie est la même que celle du fichier d'entrée.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Affiche la licence du programme.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Ajoute des sauts de lignes additionnels.
.Sp
\&\fBdos2unix\fR: Seuls les sauts de lignes du \s-1DOS\s0 sont changés en deux sauts de
lignes de Unix. En mode Mac, seuls les sauts de lignes Mac sont changés en
deux sauts de lignes Unix.
.Sp
\&\fBunix2dos\fR: Seuls les sauts de lignes Unix sont changés en deux sauts de
lignes du \s-1DOS.\s0 En mode Mac, les sauts de lignes Unix sont remplacés par deux
sauts de lignes Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Écrit une marque d'ordre des octets (\s-1BOM\s0) dans le fichier de sortie. Par
défaut une \s-1BOM UTF\-8\s0 est écrite.
.Sp
Lorsque le fichier d'entrée est en \s-1UTF\-16\s0 et que l'option \f(CW\*(C`\-u\*(C'\fR est
utilisée, une \s-1BOM UTF\-16\s0 est écrite.
.Sp
N'utilisez jamais cette option quand l'encodage du fichier de sortie n'est
ni \s-1UTF\-8\s0 ni \s-1UTF\-16.\s0 Consultez également la section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newline FICHIER_ENTRÉE \s-1FICHIER_SORTIE\s0 …\fR" 4
.IX Item "-n, --newline FICHIER_ENTRÉE FICHIER_SORTIE …"
Nouveau mode de fichiers. Convertit le fichier FICHER_ENTRÉE et écrit la
sortie dans le fichier \s-1FICHIER_SORTIE.\s0 Les noms des fichiers doivent être
indiqués par paires. Les jokers \fIne\fR doivent \fIpas\fR être utilisés ou vous
\&\fIperdrez\fR vos fichiers.
.Sp
La personne qui démarre la conversion dans le nouveau mode (pairé) des
fichiers sera le propriétaire du fichier converti. Les permissions de
lecture/écriture du nouveau fichier seront les permissions du fichier
original moins le \fIumask\fR\|(1) de la personne qui exécute la conversion.
.IP "\fB\-o, \-\-oldfile \s-1FICHIER\s0 …\fR" 4
.IX Item "-o, --oldfile FICHIER …"
Ancien mode de fichiers. Convertit le fichier \s-1FICHIER\s0 et écrit la sortie
dedans. Le programme fonctionne dans ce mode par défaut. Les jokers peuvent
être utilisés.
.Sp
Dans l'ancien mode (en place) des fichiers, les fichiers convertis ont le
même propriétaire, groupe et permissions lecture/écriture que le fichier
original. Idem quand le fichier est converti par un utilisateur qui a la
permission d'écrire dans le fichier (par exemple, root). La conversion est
interrompue si il n'est pas possible de conserver les valeurs d'origine. Le
changement de propriétaire pourrait signifier que le propriétaire original
n'est plus en mesure de lire le fichier. Le changement de groupe pourrait
être un risque pour la sécurité. Le fichier pourrait être rendu accessible
en lecture par des personnes à qui il n'est pas destiné. La conservation du
propriétaire, du groupe et des permissions de lecture/écriture n'est
supportée que sous Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Mode silencieux. Supprime les avertissements et les messages. La valeur de
sortie est zéro sauf quand de mauvaises options sont utilisées sur la ligne
de commande.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Supprime la marque d'ordre des octets (\s-1BOM\s0). N'écrit pas la \s-1BOM\s0 dans le
fichier de sortie. Ceci est le comportement par défaut lorsque les sauts de
lignes sont convertis au format Unix. Consultez aussi l'option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignore les fichiers binaires (par défaut).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Conserve l'encodage \s-1UTF\-16\s0 original du fichier d'entrée. Le fichier de
sortie sera écrit dans le même encodage \s-1UTF\-16 \s0(petit ou grand boutien) que
le fichier d'entrée. Ceci évite la transformation en \s-1UTF\-8.\s0 Une \s-1BOM UTF\-16\s0
sera écrite en conséquent. Cette option peut être désactivée avec l'option
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Suppose que le fichier d'entrée est au format \s-1UTF\-16LE.\s0
.Sp
Quand il y a un indicateur d'ordre des octets dans le fichier d'entrée,
l'indicateur a priorité sur cette option.
.Sp
Si vous vous êtes trompé sur le format du fichier d'entrée (par exemple, ce
n'était pas un fichier \s-1UTF16\-LE\s0) et que la conversion réussi, vous
obtiendrez un fichier \s-1UTF\-8\s0 contenant le mauvais texte. Vous pouvez
récupérer le fichier original avec \fIiconv\fR\|(1) en convertissant le fichier de
sortie \s-1UTF\-8\s0 vers du \s-1UTF\-16LE.\s0
.Sp
La présupposition de l'\s-1UTF\-16LE\s0 fonctionne comme un \fImode de
conversion\fR. En utilisant le mode \fIascii\fR par défaut, \s-1UTF\-16LE\s0 n'est plus
présupposé.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Suppose que le fichier d'entrée est au format \s-1UTF\-16BE.\s0
.Sp
Cette option fonctionne comme l'option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Affiche des messages verbeux. Des informations supplémentaires sont
affichées à propos des marques d'ordre des octets et du nombre de sauts de
lignes convertis.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Suit les liens symboliques et convertit les cibles.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Remplace les liens symboliques par les fichiers convertis (les fichiers
cibles originaux restent inchangés).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Ne change pas les liens symboliques ni les cibles (par défaut).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Affiche les informations de version puis arrête.
.SH "MODE MAC"
.IX Header "MODE MAC"
En mode normal, les sauts de lignes sont convertis du \s-1DOS\s0 vers Unix et
inversement. Les sauts de lignes Mac ne sont pas convertis.
.PP
En mode Mac, les sauts de lignes sont convertis du format Mac au format Unix
et inversement. Les sauts de lignes \s-1DOS\s0 ne sont pas changés.
.PP
Pour fonctionner en mode Mac, utilisez l'option en ligne de commande \f(CW\*(C`\-c
mac\*(C'\fR ou utilisez les commandes \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODES DE CONVERSION"
.IX Header "MODES DE CONVERSION"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En mode \f(CW\*(C`ascii\*(C'\fR, seuls les sauts de lignes sont convertis. Ceci est le mode
de conversion par défaut.
.Sp
Bien que le nom de ce mode soit \s-1ASCII,\s0 qui est un standard 7 bits, ce mode
travail en réalité sur 8 bits. Utilisez toujours ce mode lorsque vous
convertissez des fichiers Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Dans ce mode, tous les caractères 8 bits non \s-1ASCII \s0(avec des valeurs entre
128 et 255) sont remplacés par une espace 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Les caractères sont convertis entre un jeu de caractères \s-1DOS \s0(code page) et
le jeu de caractères \s-1ISO\-8859\-1 \s0(Latin\-1) de Unix. Les caractères \s-1DOS\s0 sans
équivalent \s-1ISO\-8859\-1,\s0 pour lesquels la conversion n'est pas possible, sont
remplacés par un point. La même chose est valable pour les caractères
\&\s-1ISO\-8859\-1\s0 sans équivalent \s-1DOS.\s0
.Sp
Quand seule l'option \f(CW\*(C`\-iso\*(C'\fR est utilisée, dos2unix essaie de déterminer le
code page actif. Quand ce n'est pas possible, dos2unix utilise le code page
\&\s-1CP437\s0 par défaut qui est surtout utilisé aux \s-1USA.\s0 Pour forcer l'utilisation
d'un code page spécifique, utilisez les options \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR
(Europe de l'ouest), \f(CW\*(C`\-860\*(C'\fR (portugais), \f(CW\*(C`\-863\*(C'\fR (français canadien) ou
\&\f(CW\*(C`\-865\*(C'\fR (nordique). Le code page \s-1CP1252\s0 de Windows (Europe de l'ouest) est
également supporté avec l'option \f(CW\*(C`\-1252\*(C'\fR. Pour d'autres codes pages,
utilisez dos2unix avec \fIiconv\fR\|(1). Iconv supporte une longue liste de codages
de caractères.
.Sp
N'utilisez jamais la conversion \s-1ISO\s0 sur des fichiers textes Unicode. Cela va
corrompre les fichiers encodés en \s-1UTF\-8.\s0
.Sp
Quelques exemples:
.Sp
Convertir du code page par défaut du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP850\s0 du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP1252\s0 de Windows au Latin\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1CP1252\s0 de Windows en \s-1UTF\-8\s0 de Unix (Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrée.txt | dos2unix > sortie.txt
.Ve
.Sp
Convertir du Latin\-1 de Unix au code page par défaut de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP850\s0 du \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1UTF\-8\s0 de Unix (Unicode) en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t CP1252 > sortie.txt
.Ve
.Sp
Consultez aussi <http://czyborra.com/charsets/codepages.html> et
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codages"
.IX Subsection "Codages"
Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers sont
généralement codés en \s-1UTF\-8.\s0 Sous Windows, les fichiers textes Unicode
peuvent être codés en \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 gros boutien mais ils sont
majoritairement codés au format \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Les fichiers textes Unicode peuvent avoir des sauts de lignes \s-1DOS,\s0 Unix ou
Mac, tout comme les fichiers textes normaux.
.PP
Toutes les versions de dos2unix et unix2dos peuvent convertir des fichiers
codés en \s-1UTF\-8\s0 car \s-1UTF\-8\s0 a été conçu pour être rétro\-compatible avec
l'\s-1ASCII.\s0
.PP
Dos2unix et unix2dos, avec le support pour l'Unicode \s-1UTF\-16,\s0 peuvent lire
les fichiers textes codés sous forme petit boutien ou gros boutien. Pour
savoir si dos2unix a été compilé avec le support \s-1UTF\-16\s0 tapez \f(CW\*(C`dos2unix
\&\-V\*(C'\fR.
.PP
Sous Unix/Linux, les fichiers encodés en \s-1UTF\-16\s0 sont convertis vers
l'encodage des caractères de la localisation. Utilisez \fIlocale\fR\|(1) pour
découvrir quel encodage de caractères est utilisé. Lorsque la conversion
n'est pas possible, une erreur de conversion est produite et le fichier est
abandonné.
.PP
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis par défaut en \s-1UTF\-8.\s0 Les
fichiers textes formatés en \s-1UTF\-8\s0 sont bien supportés sous Windows et
Unix/Linux.
.PP
Les codages \s-1UTF\-16\s0 et \s-1UTF\-8\s0 sont parfaitement compatibles. Il n'y a pas de
pertes lors de la conversion. Lorsqu'une erreur de conversion \s-1UTF\-16\s0 vers
\&\s-1UTF\-8\s0 survient, par exemple, quand le fichier d'entrée \s-1UTF\-16\s0 contient une
erreur, le fichier est ignoré.
.PP
Quand l'option \f(CW\*(C`\-u\*(C'\fR est utilisée, le fichier de sortie est écrit dans le
même encodage \s-1UTF\-16\s0 que le fichier d'entrée. L'option \f(CW\*(C`\-u\*(C'\fR empêche la
conversion en \s-1UTF\-8.\s0
.PP
Dos2unix et unix2dos n'ont pas d'option pour convertir des fichiers \s-1UTF\-8\s0 en
\&\s-1UTF\-16.\s0
.PP
Les modes de conversion \s-1ISO\s0 et 7 bits ne fonctionnent pas sur des fichiers
\&\s-1UTF\-16.\s0
.SS "Marque d'ordre des octets"
.IX Subsection "Marque d'ordre des octets"
Les fichiers textes Unicode sous Windows on généralement un indicateur
d'ordre des octets (\s-1BOM\s0) car de nombreux programmes Windows (y compris
Notepad) ajoutent cet indicateur par défaut. Consultez aussi
<http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets>.
.PP
Sous Unix, les fichiers Unicodes n'ont habituellement pas de \s-1BOM.\s0 Il est
supposé que les fichiers textes sont codés selon le codage de
l'environnement linguistique.
.PP
Dos2unix ne peut détecter que le fichier est au format \s-1UTF\-16\s0 si le fichier
n'a pas de \s-1BOM.\s0 Quand le fichier \s-1UTF\-16\s0 n'a pas cet indicateur, dos2unix
voit le fichier comme un fichier binaire.
.PP
Utilisez l'option \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR pour convertir un fichier \s-1UTF\-16\s0 sans
\&\s-1BOM.\s0
.PP
Dos2unix, par défaut, n'écrit pas de \s-1BOM\s0 dans le fichier de sortie. Avec
l'option \f(CW\*(C`\-b\*(C'\fR, Dos2unix écrit une \s-1BOM\s0 quand le fichier d'entrée a une \s-1BOM.\s0
.PP
Unix2dos écrit par défaut une \s-1BOM\s0 dans le fichier de sortie quand le fichier
d'entrée a une \s-1BOM.\s0 Utilisez l'option \f(CW\*(C`\-r\*(C'\fR pour supprimer la \s-1BOM.\s0
.PP
Dos2unix et unix2dos écrivent toujours une \s-1BOM\s0 quand l'option \f(CW\*(C`\-m\*(C'\fR est
utilisée.
.SS "Exemples Unicode"
.IX Subsection "Exemples Unicode"
Convertir de l'\s-1UTF\-16\s0 Windows (avec \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-16LE\s0 de Windows (sans \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-8\s0 de Windows avec \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-16\s0 de Windows:
.PP
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t UTF\-16 > sortie.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 est un standard du gouvernement chinois. Tout logiciel vendu en
Chine doit officiellement supporter un sous ensemble obligatoire du standard
\&\s-1GB18030.\s0 Consultez <http://fr.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 est entièrement compatible avec Unicode et peut être considéré comme
étant un format de transformation unicode. Comme \s-1UTF\-8, GB18030\s0 est
compatible avec \s-1ASCII. GB18030\s0 est aussi compatible avec le code page 936 de
Windows aussi connu comme \s-1GBK.\s0
.PP
Sous Unix/Linux, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1GB18030\s0 quand
l'encodage de la localisation est \s-1GB18030.\s0 Notez que cela ne fonctionnera
que si l'emplacement est en Chine. Autrement dit, dans la localisation
anglaise britannique \f(CW\*(C`en_GB.GB18030\*(C'\fR, la conversion de \s-1UTF\-16\s0 vers \s-1GB18030\s0
ne fonctionnera pas mais une localisation chinoise \f(CW\*(C`zh_CN.GB18030\*(C'\fR
fonctionnera.
.PP
Sous Windows, vous avez besoin de l'option \f(CW\*(C`\-gb\*(C'\fR pour convertir \s-1UTF\-16\s0 en
\&\s-1GB18030.\s0
.PP
Les fichiers encodés en \s-1GB18030\s0 peuvent avoir une marque d'ordre des octets,
comme les fichiers Unicode.
.SH "EXEMPLES"
.IX Header "EXEMPLES"
Lire l'entrée depuis « stdin » et écrire la sortie vers « stdout » :
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convertir et remplacer a.txt. Convertir et remplace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii. Convertir et
remplacer b.txt en mode de conversion 7 bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convertir a.txt depuis le format Mac vers le format Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convertir a.txt du format Unix au format Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convertir et remplacer a.txt tout en conservant la date originale:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt. La date de e.txt est la même que celle
de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convertir et remplacer a.txt. Convertir b.txt et écrire dans e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convertir c.txt et écrire dans e.txt. Convertir et remplacer
a.txt. Convertir et remplacer b.txt. Convertir d.txt et écrire dans f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIONS RÉCURSIVES"
.IX Header "CONVERSIONS RÉCURSIVES"
Utilisez dos2unix avec les commandes \fIfind\fR\|(1) et \fIxargs\fR\|(1) pour convertir
récursivement des fichiers textes dans une arborescence de répertoires. Par
exemple, pour convertir tous les fichiers .txt dans les répertoires sous le
répertoire courant, tapez:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "PARAMÈTRES LINGUISTIQUES"
.IX Header "PARAMÈTRES LINGUISTIQUES"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
La langue principale est sélectionnée par la variable d'environnement
\&\s-1LANG.\s0 La variable \s-1LANG\s0 est composée de plusieurs parties. La première partie
est le code de la langue en minuscules. La deuxième partie est le code du
pays en majuscules précédé d'un souligné. Elle est facultative. Il y a aussi
une troisième partie facultative qui est le codage des caractères précédé
par un point. Voici quelques exemples pour un shell au standard \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=fr Français
\& export LANG=fr_CA Français, Canada
\& export LANG=fr_BE Français, Belgique
\& export LANG=es_ES Espagnol, Espagne
\& export LANG=es_MX Espagnol, Mexique
\& export LANG=en_US.iso88591 Anglais, USA, codage Latin\-1
\& export LANG=en_GB.UTF\-8 Anglais, UK, codage UTF\-8
.Ve
.Sp
La liste complète des codes de langues et de pays est dans le manuel de
gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Sur les systèmes Unix, vous pouvez utiliser la commande \fIlocale\fR\|(1) pour
obtenir des informations sur l'environnement linguistique.
.IP "\fB\s-1LANGUE\s0\fR" 4
.IX Item "LANGUE"
Avec la variable d'environnement \s-1LANGUAGE,\s0 vous pouvez spécifier une liste
de langues prioritaires séparées par des deux-points. Dos2unix fait passer
\&\s-1LANGUAGE\s0 avant \s-1LANG.\s0 Par exemple, pour utiliser le français avant l'anglais:
\&\f(CW\*(C`LANGUAGE=fr:en\*(C'\fR. Vous devez d'abord activer l'environnement linguistique
en assignant une valeur autre que « C » à \s-1LANG \s0(ou \s-1LC_ALL\s0). Ensuite, vous
pourrez utiliser la liste de priorité avec la variable \s-1LANGUAGE.\s0 Voyez
également le manuel de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si vous sélectionnez une langue qui n'est pas disponible, vous obtiendrez
des messages en anglais standard.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Grâce à la variable d'environnement \s-1DOS2UNIX_LOCALEDIR,\s0 la variable
\&\s-1LOCALEDIR\s0 compilée dans l'application peut être remplacée. \s-1LOCALEDIR\s0 est
utilisée pour trouver les fichiers de langue. La valeur par défaut de \s-1GNU\s0
est \f(CW\*(C`/usr/local/share/locale\*(C'\fR. L'option \fB\-\-version\fR affiche la valeur de
\&\s-1LOCALEDIR\s0 utilisée.
.Sp
Exemple (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALEUR DE RETOUR"
.IX Header "VALEUR DE RETOUR"
Zéro est retourné en cas de succès. Si une erreur système se produit, la
dernière erreur système est retournée. Pour les autres erreurs, 1 est
renvoyé.
.PP
La valeur de sortie est toujours zéro en mode silencieux sauf quand de
mauvaises options sont utilisées sur la ligne de commande.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://fr.wikipedia.org/wiki/Fichier_texte>
.PP
<http://fr.wikipedia.org/wiki/Retour_chariot>
.PP
<http://fr.wikipedia.org/wiki/Fin_de_ligne>
.PP
<http://fr.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mode
mac2unix) \- <wuebben@kde.org>, Christian Wurll (ajout de saut de ligne
supplémentaire) \- <wurll@ira.uka.de>, Erwin Waterlander \-
<waterlan@xs4all.nl> (Mainteneur)
.PP
Page du projet: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Page SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VOIR AUSSI"
.IX Header "VOIR AUSSI"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,775 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOM"
.IX Header "NOM"
dos2unix \- Convertit les fichiers textes du format DOS/Mac vers Unix et
inversement
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
\& unix2dos [options] [FICHIER …] [\-n FICHIER_ENTRÉE FICHIER_SORTIE …]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Le package Dos2unix inclut les utilitaires \f(CW\*(C`dos2unix\*(C'\fR et \f(CW\*(C`unix2dos\*(C'\fR pour
convertir des fichiers textes au format \s-1DOS\s0 ou Mac vers le format Unix et
inversement.
.PP
Dans les fichiers textes DOS/Windows, un saut de ligne est une combinaison
de deux caractères: un retour de chariot (\s-1CR\s0) suivi d'un saut de ligne
(\s-1LF\s0). Dans les fichiers textes Unix, le saut de ligne est un seul caractère:
le saut de ligne (\s-1LF\s0). Les fichiers textes Mac, avant Mac \s-1OS X,\s0 utilisaient
le retour chariot (\s-1CR\s0) comme seul caractère. De nos jours, Mac \s-1OS\s0 utilise le
même style de saut de ligne que Unix (\s-1LF\s0).
.PP
Outre les sauts de lignes, Dos2unix convertit aussi le codage des
fichiers. Quelques codes page \s-1DOS\s0 peuvent être convertis en Latin\-1 sous
Unix. L'Unicode des fichiers Windows (\s-1UTF\-16\s0) peut être converti en Unicode
Unix (\s-1UTF\-8\s0).
.PP
Les fichiers binaires sont automatiquement ignorés à moins que la conversion
soit forcée.
.PP
Les fichiers non réguliers tels que les répertoires et les FIFOs sont
automatiquement ignorés.
.PP
Les liens symboliques et leur cible sont, par défaut, inchangés. En option,
les liens symboliques peuvent être remplacés ou, au choix, la sortie peut
être écrite dans la cible du lien symbolique. Écrire dans la cible d'un lien
symbolique n'est pas supporté sous Windows.
.PP
Dos2unix a été conçu comme dos2unix sous SunOS/Solaris. Il y a une
différence importante avec la version originale de SunOS/Solaris. Cette
version effectue les conversions en place (ancien mode de fichiers) tandis
que la version originale de SunOS/Solaris ne supporte que la conversion par
paire (nouveau mode de fichier). Voyez aussi les options \f(CW\*(C`\-o\*(C'\fR et \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Traites toutes les options à sa suite comme étant des noms de
fichiers. Utilisez cette option si vous voulez convertir des fichiers dont
le nom commence par un tiret. Par exemple, pour convertir un fichier nommé
« \-foo », vous pouvez utiliser cette commande:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou dans le style des nouveaux fichiers:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo sortie.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convertit uniquement les sauts de lignes. C'est le mode de conversion par
défaut.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Convertit le jeu de caractères du \s-1DOS\s0 vers \s-1ISO\-8859\-1.\s0 Voyez aussi la
section des \s-1MODES DE CONVERSION.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Utilise le code page 1252 de Windows (Europe de l'ouest).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Utilise le code page 437 du \s-1DOS \s0(\s-1US\s0). C'est le code page par défaut pour les
conversions \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Utilise le code page 850 du \s-1DOS \s0(Europe de l'ouest).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Utilise le code page 860 du \s-1DOS \s0(portugais).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Utilise le code page 863 du \s-1DOS \s0(français canadien).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Utilise le code page 865 du \s-1DOS \s0(nordique).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convertit les caractères 8 bits vers l'espace 7 bits.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Conserve la marque d'ordre des octets (\s-1BOM\s0). Si le fichier d'entrée a une
\&\s-1BOM,\s0 elle est écrite dans le fichier de sortie. C'est le comportement par
défaut quand les sauts de lignes sont convertis au format \s-1DOS.\s0 Consultez
aussi l'option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODE_CONV\s0\fR" 4
.IX Item "-c, --convmode MODE_CONV"
Change le mode de conversion. \s-1MODE_CONV\s0 prend l'une des valeurs: \fIascii\fR,
\&\fI7bit\fR, \fIiso\fR, \fImac\fR. Ascii est la valeur par défaut.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force la conversion de fichiers binaires.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1UTF\-8\s0 par défaut sans
considération pour les paramètres de la localisation. Utilisez cette option
pour convertir \s-1UTF\-16\s0 en \s-1GB18030.\s0 Cette option n'est disponible que sous
Windows. Consultez aussi la section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Affiche l'aide et s'arrête.
.IP "\fB\-i[\s-1FANIONS\s0], \-\-info[=FANIONS] \s-1FICHIER\s0 …\fR" 4
.IX Item "-i[FANIONS], --info[=FANIONS] FICHIER …"
Affiche les informations du fichier. Aucune conversion n'est réalisée.
.Sp
Les informations suivantes sont affichées dans cet ordre: le nombre de sauts
de ligne \s-1DOS,\s0 le nombre de sauts de ligne Unix, le nombre de sauts de ligne
Mac, la marque d'ordre des octets, texte ou binaire, nom du fichier.
.Sp
Exemple de sortie :
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Des fanions facultatifs peuvent être ajoutés pour changer la sortie. Un ou
plusieurs fanions peuvent être ajoutés.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Affiche le nombre de sauts de ligne \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Affiche le nombre de sauts de ligne Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Affiche le nombre de sauts de ligne Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Afficher la marque d'ordre des octets.
.IP "\fBt\fR" 4
.IX Item "t"
Affiche si le fichier est texte ou binaire.
.IP "\fBc\fR" 4
.IX Item "c"
Affiche uniquement les fichiers qui seraient convertis.
.Sp
Avec le fanion \f(CW\*(C`c\*(C'\fR, dos2unix n'affichera que les fichiers contenant des
sauts de ligne \s-1DOS\s0 alors que unix2dos n'affichera que les noms des fichiers
aillant des sauts de ligne Unix.
.RE
.RS 4
.Sp
Exemples:
.Sp
Afficher les informations pour tous les fichier *.txt :
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Afficher uniquement le nombre de sauts de ligne \s-1DOS\s0 et Unix :
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Montrer uniquement la marque d'ordre des octets :
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Liste les fichiers qui ont des sauts de ligne Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
La date du fichier de sortie est la même que celle du fichier d'entrée.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Affiche la licence du programme.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Ajoute des sauts de lignes additionnels.
.Sp
\&\fBdos2unix\fR: Seuls les sauts de lignes du \s-1DOS\s0 sont changés en deux sauts de
lignes de Unix. En mode Mac, seuls les sauts de lignes Mac sont changés en
deux sauts de lignes Unix.
.Sp
\&\fBunix2dos\fR: Seuls les sauts de lignes Unix sont changés en deux sauts de
lignes du \s-1DOS.\s0 En mode Mac, les sauts de lignes Unix sont remplacés par deux
sauts de lignes Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Écrit une marque d'ordre des octets (\s-1BOM\s0) dans le fichier de sortie. Par
défaut une \s-1BOM UTF\-8\s0 est écrite.
.Sp
Lorsque le fichier d'entrée est en \s-1UTF\-16\s0 et que l'option \f(CW\*(C`\-u\*(C'\fR est
utilisée, une \s-1BOM UTF\-16\s0 est écrite.
.Sp
N'utilisez jamais cette option quand l'encodage du fichier de sortie n'est
ni \s-1UTF\-8\s0 ni \s-1UTF\-16.\s0 Consultez également la section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newline FICHIER_ENTRÉE \s-1FICHIER_SORTIE\s0 …\fR" 4
.IX Item "-n, --newline FICHIER_ENTRÉE FICHIER_SORTIE …"
Nouveau mode de fichiers. Convertit le fichier FICHER_ENTRÉE et écrit la
sortie dans le fichier \s-1FICHIER_SORTIE.\s0 Les noms des fichiers doivent être
indiqués par paires. Les jokers \fIne\fR doivent \fIpas\fR être utilisés ou vous
\&\fIperdrez\fR vos fichiers.
.Sp
La personne qui démarre la conversion dans le nouveau mode (pairé) des
fichiers sera le propriétaire du fichier converti. Les permissions de
lecture/écriture du nouveau fichier seront les permissions du fichier
original moins le \fIumask\fR\|(1) de la personne qui exécute la conversion.
.IP "\fB\-o, \-\-oldfile \s-1FICHIER\s0 …\fR" 4
.IX Item "-o, --oldfile FICHIER …"
Ancien mode de fichiers. Convertit le fichier \s-1FICHIER\s0 et écrit la sortie
dedans. Le programme fonctionne dans ce mode par défaut. Les jokers peuvent
être utilisés.
.Sp
Dans l'ancien mode (en place) des fichiers, les fichiers convertis ont le
même propriétaire, groupe et permissions lecture/écriture que le fichier
original. Idem quand le fichier est converti par un utilisateur qui a la
permission d'écrire dans le fichier (par exemple, root). La conversion est
interrompue si il n'est pas possible de conserver les valeurs d'origine. Le
changement de propriétaire pourrait signifier que le propriétaire original
n'est plus en mesure de lire le fichier. Le changement de groupe pourrait
être un risque pour la sécurité. Le fichier pourrait être rendu accessible
en lecture par des personnes à qui il n'est pas destiné. La conservation du
propriétaire, du groupe et des permissions de lecture/écriture n'est
supportée que sous Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Mode silencieux. Supprime les avertissements et les messages. La valeur de
sortie est zéro sauf quand de mauvaises options sont utilisées sur la ligne
de commande.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Supprime la marque d'ordre des octets (\s-1BOM\s0). N'écrit pas la \s-1BOM\s0 dans le
fichier de sortie. Ceci est le comportement par défaut lorsque les sauts de
lignes sont convertis au format Unix. Consultez aussi l'option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignore les fichiers binaires (par défaut).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Conserve l'encodage \s-1UTF\-16\s0 original du fichier d'entrée. Le fichier de
sortie sera écrit dans le même encodage \s-1UTF\-16 \s0(petit ou grand boutien) que
le fichier d'entrée. Ceci évite la transformation en \s-1UTF\-8.\s0 Une \s-1BOM UTF\-16\s0
sera écrite en conséquent. Cette option peut être désactivée avec l'option
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Suppose que le fichier d'entrée est au format \s-1UTF\-16LE.\s0
.Sp
Quand il y a un indicateur d'ordre des octets dans le fichier d'entrée,
l'indicateur a priorité sur cette option.
.Sp
Si vous vous êtes trompé sur le format du fichier d'entrée (par exemple, ce
n'était pas un fichier \s-1UTF16\-LE\s0) et que la conversion réussi, vous
obtiendrez un fichier \s-1UTF\-8\s0 contenant le mauvais texte. Vous pouvez
récupérer le fichier original avec \fIiconv\fR\|(1) en convertissant le fichier de
sortie \s-1UTF\-8\s0 vers du \s-1UTF\-16LE.\s0
.Sp
La présupposition de l'\s-1UTF\-16LE\s0 fonctionne comme un \fImode de
conversion\fR. En utilisant le mode \fIascii\fR par défaut, \s-1UTF\-16LE\s0 n'est plus
présupposé.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Suppose que le fichier d'entrée est au format \s-1UTF\-16BE.\s0
.Sp
Cette option fonctionne comme l'option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Affiche des messages verbeux. Des informations supplémentaires sont
affichées à propos des marques d'ordre des octets et du nombre de sauts de
lignes convertis.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Suit les liens symboliques et convertit les cibles.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Remplace les liens symboliques par les fichiers convertis (les fichiers
cibles originaux restent inchangés).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Ne change pas les liens symboliques ni les cibles (par défaut).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Affiche les informations de version puis arrête.
.SH "MODE MAC"
.IX Header "MODE MAC"
En mode normal, les sauts de lignes sont convertis du \s-1DOS\s0 vers Unix et
inversement. Les sauts de lignes Mac ne sont pas convertis.
.PP
En mode Mac, les sauts de lignes sont convertis du format Mac au format Unix
et inversement. Les sauts de lignes \s-1DOS\s0 ne sont pas changés.
.PP
Pour fonctionner en mode Mac, utilisez l'option en ligne de commande \f(CW\*(C`\-c
mac\*(C'\fR ou utilisez les commandes \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODES DE CONVERSION"
.IX Header "MODES DE CONVERSION"
.IP "\fBascii\fR" 4
.IX Item "ascii"
En mode \f(CW\*(C`ascii\*(C'\fR, seuls les sauts de lignes sont convertis. Ceci est le mode
de conversion par défaut.
.Sp
Bien que le nom de ce mode soit \s-1ASCII,\s0 qui est un standard 7 bits, ce mode
travail en réalité sur 8 bits. Utilisez toujours ce mode lorsque vous
convertissez des fichiers Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Dans ce mode, tous les caractères 8 bits non \s-1ASCII \s0(avec des valeurs entre
128 et 255) sont remplacés par une espace 7 bits.
.IP "\fBiso\fR" 4
.IX Item "iso"
Les caractères sont convertis entre un jeu de caractères \s-1DOS \s0(code page) et
le jeu de caractères \s-1ISO\-8859\-1 \s0(Latin\-1) de Unix. Les caractères \s-1DOS\s0 sans
équivalent \s-1ISO\-8859\-1,\s0 pour lesquels la conversion n'est pas possible, sont
remplacés par un point. La même chose est valable pour les caractères
\&\s-1ISO\-8859\-1\s0 sans équivalent \s-1DOS.\s0
.Sp
Quand seule l'option \f(CW\*(C`\-iso\*(C'\fR est utilisée, dos2unix essaie de déterminer le
code page actif. Quand ce n'est pas possible, dos2unix utilise le code page
\&\s-1CP437\s0 par défaut qui est surtout utilisé aux \s-1USA.\s0 Pour forcer l'utilisation
d'un code page spécifique, utilisez les options \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR
(Europe de l'ouest), \f(CW\*(C`\-860\*(C'\fR (portugais), \f(CW\*(C`\-863\*(C'\fR (français canadien) ou
\&\f(CW\*(C`\-865\*(C'\fR (nordique). Le code page \s-1CP1252\s0 de Windows (Europe de l'ouest) est
également supporté avec l'option \f(CW\*(C`\-1252\*(C'\fR. Pour d'autres codes pages,
utilisez dos2unix avec \fIiconv\fR\|(1). Iconv supporte une longue liste de codages
de caractères.
.Sp
N'utilisez jamais la conversion \s-1ISO\s0 sur des fichiers textes Unicode. Cela va
corrompre les fichiers encodés en \s-1UTF\-8.\s0
.Sp
Quelques exemples:
.Sp
Convertir du code page par défaut du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP850\s0 du \s-1DOS\s0 au Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir du \s-1CP1252\s0 de Windows au Latin\-1 de Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1CP1252\s0 de Windows en \s-1UTF\-8\s0 de Unix (Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrée.txt | dos2unix > sortie.txt
.Ve
.Sp
Convertir du Latin\-1 de Unix au code page par défaut de \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP850\s0 du \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le Latin\-1 de Unix en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrée.txt sortie.txt
.Ve
.Sp
Convertir le \s-1UTF\-8\s0 de Unix (Unicode) en \s-1CP1252\s0 de Windows:
.Sp
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t CP1252 > sortie.txt
.Ve
.Sp
Consultez aussi <http://czyborra.com/charsets/codepages.html> et
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codages"
.IX Subsection "Codages"
Il existe plusieurs codages Unicode. Sous Unix et Linux, les fichiers sont
généralement codés en \s-1UTF\-8.\s0 Sous Windows, les fichiers textes Unicode
peuvent être codés en \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 gros boutien mais ils sont
majoritairement codés au format \s-1UTF\-16.\s0
.SS "Conversion"
.IX Subsection "Conversion"
Les fichiers textes Unicode peuvent avoir des sauts de lignes \s-1DOS,\s0 Unix ou
Mac, tout comme les fichiers textes normaux.
.PP
Toutes les versions de dos2unix et unix2dos peuvent convertir des fichiers
codés en \s-1UTF\-8\s0 car \s-1UTF\-8\s0 a été conçu pour être rétro\-compatible avec
l'\s-1ASCII.\s0
.PP
Dos2unix et unix2dos, avec le support pour l'Unicode \s-1UTF\-16,\s0 peuvent lire
les fichiers textes codés sous forme petit boutien ou gros boutien. Pour
savoir si dos2unix a été compilé avec le support \s-1UTF\-16\s0 tapez \f(CW\*(C`dos2unix
\&\-V\*(C'\fR.
.PP
Sous Unix/Linux, les fichiers encodés en \s-1UTF\-16\s0 sont convertis vers
l'encodage des caractères de la localisation. Utilisez \fIlocale\fR\|(1) pour
découvrir quel encodage de caractères est utilisé. Lorsque la conversion
n'est pas possible, une erreur de conversion est produite et le fichier est
abandonné.
.PP
Sous Windows, les fichiers \s-1UTF\-16\s0 sont convertis par défaut en \s-1UTF\-8.\s0 Les
fichiers textes formatés en \s-1UTF\-8\s0 sont bien supportés sous Windows et
Unix/Linux.
.PP
Les codages \s-1UTF\-16\s0 et \s-1UTF\-8\s0 sont parfaitement compatibles. Il n'y a pas de
pertes lors de la conversion. Lorsqu'une erreur de conversion \s-1UTF\-16\s0 vers
\&\s-1UTF\-8\s0 survient, par exemple, quand le fichier d'entrée \s-1UTF\-16\s0 contient une
erreur, le fichier est ignoré.
.PP
Quand l'option \f(CW\*(C`\-u\*(C'\fR est utilisée, le fichier de sortie est écrit dans le
même encodage \s-1UTF\-16\s0 que le fichier d'entrée. L'option \f(CW\*(C`\-u\*(C'\fR empêche la
conversion en \s-1UTF\-8.\s0
.PP
Dos2unix et unix2dos n'ont pas d'option pour convertir des fichiers \s-1UTF\-8\s0 en
\&\s-1UTF\-16.\s0
.PP
Les modes de conversion \s-1ISO\s0 et 7 bits ne fonctionnent pas sur des fichiers
\&\s-1UTF\-16.\s0
.SS "Marque d'ordre des octets"
.IX Subsection "Marque d'ordre des octets"
Les fichiers textes Unicode sous Windows on généralement un indicateur
d'ordre des octets (\s-1BOM\s0) car de nombreux programmes Windows (y compris
Notepad) ajoutent cet indicateur par défaut. Consultez aussi
<http://fr.wikipedia.org/wiki/Indicateur_d%27ordre_des_octets>.
.PP
Sous Unix, les fichiers Unicodes n'ont habituellement pas de \s-1BOM.\s0 Il est
supposé que les fichiers textes sont codés selon le codage de
l'environnement linguistique.
.PP
Dos2unix ne peut détecter que le fichier est au format \s-1UTF\-16\s0 si le fichier
n'a pas de \s-1BOM.\s0 Quand le fichier \s-1UTF\-16\s0 n'a pas cet indicateur, dos2unix
voit le fichier comme un fichier binaire.
.PP
Utilisez l'option \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR pour convertir un fichier \s-1UTF\-16\s0 sans
\&\s-1BOM.\s0
.PP
Dos2unix, par défaut, n'écrit pas de \s-1BOM\s0 dans le fichier de sortie. Avec
l'option \f(CW\*(C`\-b\*(C'\fR, Dos2unix écrit une \s-1BOM\s0 quand le fichier d'entrée a une \s-1BOM.\s0
.PP
Unix2dos écrit par défaut une \s-1BOM\s0 dans le fichier de sortie quand le fichier
d'entrée a une \s-1BOM.\s0 Utilisez l'option \f(CW\*(C`\-r\*(C'\fR pour supprimer la \s-1BOM.\s0
.PP
Dos2unix et unix2dos écrivent toujours une \s-1BOM\s0 quand l'option \f(CW\*(C`\-m\*(C'\fR est
utilisée.
.SS "Exemples Unicode"
.IX Subsection "Exemples Unicode"
Convertir de l'\s-1UTF\-16\s0 Windows (avec \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-16LE\s0 de Windows (sans \s-1BOM\s0) vers l'\s-1UTF\-8\s0 de Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-8\s0 de Windows avec \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrée.txt sortie.txt
.Ve
.PP
Convertir de l'\s-1UTF\-8\s0 de Unix vers l'\s-1UTF\-16\s0 de Windows:
.PP
.Vb 1
\& unix2dos < entrée.txt | iconv \-f UTF\-8 \-t UTF\-16 > sortie.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 est un standard du gouvernement chinois. Tout logiciel vendu en
Chine doit officiellement supporter un sous ensemble obligatoire du standard
\&\s-1GB18030.\s0 Consultez <http://fr.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 est entièrement compatible avec Unicode et peut être considéré comme
étant un format de transformation unicode. Comme \s-1UTF\-8, GB18030\s0 est
compatible avec \s-1ASCII. GB18030\s0 est aussi compatible avec le code page 936 de
Windows aussi connu comme \s-1GBK.\s0
.PP
Sous Unix/Linux, les fichiers \s-1UTF\-16\s0 sont convertis en \s-1GB18030\s0 quand
l'encodage de la localisation est \s-1GB18030.\s0 Notez que cela ne fonctionnera
que si l'emplacement est en Chine. Autrement dit, dans la localisation
anglaise britannique \f(CW\*(C`en_GB.GB18030\*(C'\fR, la conversion de \s-1UTF\-16\s0 vers \s-1GB18030\s0
ne fonctionnera pas mais une localisation chinoise \f(CW\*(C`zh_CN.GB18030\*(C'\fR
fonctionnera.
.PP
Sous Windows, vous avez besoin de l'option \f(CW\*(C`\-gb\*(C'\fR pour convertir \s-1UTF\-16\s0 en
\&\s-1GB18030.\s0
.PP
Les fichiers encodés en \s-1GB18030\s0 peuvent avoir une marque d'ordre des octets,
comme les fichiers Unicode.
.SH "EXEMPLES"
.IX Header "EXEMPLES"
Lire l'entrée depuis « stdin » et écrire la sortie vers « stdout » :
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convertir et remplacer a.txt. Convertir et remplace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convertir et remplacer a.txt en mode de conversion ascii. Convertir et
remplacer b.txt en mode de conversion 7 bits:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convertir a.txt depuis le format Mac vers le format Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convertir a.txt du format Unix au format Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convertir et remplacer a.txt tout en conservant la date originale:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convertir a.txt et écrire dans e.txt. La date de e.txt est la même que celle
de a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convertir et remplacer a.txt. Convertir b.txt et écrire dans e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convertir c.txt et écrire dans e.txt. Convertir et remplacer
a.txt. Convertir et remplacer b.txt. Convertir d.txt et écrire dans f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "CONVERSIONS RÉCURSIVES"
.IX Header "CONVERSIONS RÉCURSIVES"
Utilisez dos2unix avec les commandes \fIfind\fR\|(1) et \fIxargs\fR\|(1) pour convertir
récursivement des fichiers textes dans une arborescence de répertoires. Par
exemple, pour convertir tous les fichiers .txt dans les répertoires sous le
répertoire courant, tapez:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "PARAMÈTRES LINGUISTIQUES"
.IX Header "PARAMÈTRES LINGUISTIQUES"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
La langue principale est sélectionnée par la variable d'environnement
\&\s-1LANG.\s0 La variable \s-1LANG\s0 est composée de plusieurs parties. La première partie
est le code de la langue en minuscules. La deuxième partie est le code du
pays en majuscules précédé d'un souligné. Elle est facultative. Il y a aussi
une troisième partie facultative qui est le codage des caractères précédé
par un point. Voici quelques exemples pour un shell au standard \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=fr Français
\& export LANG=fr_CA Français, Canada
\& export LANG=fr_BE Français, Belgique
\& export LANG=es_ES Espagnol, Espagne
\& export LANG=es_MX Espagnol, Mexique
\& export LANG=en_US.iso88591 Anglais, USA, codage Latin\-1
\& export LANG=en_GB.UTF\-8 Anglais, UK, codage UTF\-8
.Ve
.Sp
La liste complète des codes de langues et de pays est dans le manuel de
gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Sur les systèmes Unix, vous pouvez utiliser la commande \fIlocale\fR\|(1) pour
obtenir des informations sur l'environnement linguistique.
.IP "\fB\s-1LANGUE\s0\fR" 4
.IX Item "LANGUE"
Avec la variable d'environnement \s-1LANGUAGE,\s0 vous pouvez spécifier une liste
de langues prioritaires séparées par des deux-points. Dos2unix fait passer
\&\s-1LANGUAGE\s0 avant \s-1LANG.\s0 Par exemple, pour utiliser le français avant l'anglais:
\&\f(CW\*(C`LANGUAGE=fr:en\*(C'\fR. Vous devez d'abord activer l'environnement linguistique
en assignant une valeur autre que « C » à \s-1LANG \s0(ou \s-1LC_ALL\s0). Ensuite, vous
pourrez utiliser la liste de priorité avec la variable \s-1LANGUAGE.\s0 Voyez
également le manuel de gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Si vous sélectionnez une langue qui n'est pas disponible, vous obtiendrez
des messages en anglais standard.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Grâce à la variable d'environnement \s-1DOS2UNIX_LOCALEDIR,\s0 la variable
\&\s-1LOCALEDIR\s0 compilée dans l'application peut être remplacée. \s-1LOCALEDIR\s0 est
utilisée pour trouver les fichiers de langue. La valeur par défaut de \s-1GNU\s0
est \f(CW\*(C`/usr/local/share/locale\*(C'\fR. L'option \fB\-\-version\fR affiche la valeur de
\&\s-1LOCALEDIR\s0 utilisée.
.Sp
Exemple (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALEUR DE RETOUR"
.IX Header "VALEUR DE RETOUR"
Zéro est retourné en cas de succès. Si une erreur système se produit, la
dernière erreur système est retournée. Pour les autres erreurs, 1 est
renvoyé.
.PP
La valeur de sortie est toujours zéro en mode silencieux sauf quand de
mauvaises options sont utilisées sur la ligne de commande.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://fr.wikipedia.org/wiki/Fichier_texte>
.PP
<http://fr.wikipedia.org/wiki/Retour_chariot>
.PP
<http://fr.wikipedia.org/wiki/Fin_de_ligne>
.PP
<http://fr.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (mode
mac2unix) \- <wuebben@kde.org>, Christian Wurll (ajout de saut de ligne
supplémentaire) \- <wurll@ira.uka.de>, Erwin Waterlander \-
<waterlan@xs4all.nl> (Mainteneur)
.PP
Page du projet: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Page SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "VOIR AUSSI"
.IX Header "VOIR AUSSI"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,730 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-01-02" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
dos2unix \- DOS/Mac to Unix and vice versa text file format converter
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FILE ...] [\-n INFILE OUTFILE ...]
\& unix2dos [options] [FILE ...] [\-n INFILE OUTFILE ...]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The Dos2unix package includes utilities \f(CW\*(C`dos2unix\*(C'\fR and \f(CW\*(C`unix2dos\*(C'\fR to convert
plain text files in \s-1DOS\s0 or Mac format to Unix format and vice versa.
.PP
In DOS/Windows text files a line break, also known as newline, is a combination
of two characters: a Carriage Return (\s-1CR\s0) followed by a Line Feed (\s-1LF\s0). In Unix
text files a line break is a single character: the Line Feed (\s-1LF\s0). In Mac text
files, prior to Mac \s-1OS X,\s0 a line break was single Carriage Return (\s-1CR\s0)
character. Nowadays Mac \s-1OS\s0 uses Unix style (\s-1LF\s0) line breaks.
.PP
Besides line breaks Dos2unix can also convert the encoding of files. A few
\&\s-1DOS\s0 code pages can be converted to Unix Latin\-1. And Windows Unicode (\s-1UTF\-16\s0)
files can be converted to Unix Unicode (\s-1UTF\-8\s0) files.
.PP
Binary files are automatically skipped, unless conversion is forced.
.PP
Non-regular files, such as directories and FIFOs, are automatically skipped.
.PP
Symbolic links and their targets are by default kept untouched. Symbolic links
can optionally be replaced, or the output can be written to the symbolic link
target. Writing to a symbolic link target is not supported on Windows.
.PP
Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
important difference with the original SunOS/Solaris version. This version does
by default in-place conversion (old file mode), while the original
SunOS/Solaris version only supports paired conversion (new file mode). See also
options \f(CW\*(C`\-o\*(C'\fR and \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Treat all following options as file names. Use this option if you want to
convert files whose names start with a dash. For instance to convert
a file named \*(L"\-foo\*(R", you can use this command:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Or in new file mode:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convert only line breaks. This is the default conversion mode.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversion between \s-1DOS\s0 and \s-1ISO\-8859\-1\s0 character set. See also section
\&\s-1CONVERSION MODES.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Use Windows code page 1252 (Western European).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Use \s-1DOS\s0 code page 437 (\s-1US\s0). This is the default code page used for \s-1ISO\s0 conversion.
.IP "\fB\-850\fR" 4
.IX Item "-850"
Use \s-1DOS\s0 code page 850 (Western European).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Use \s-1DOS\s0 code page 860 (Portuguese).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Use \s-1DOS\s0 code page 863 (French Canadian).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Use \s-1DOS\s0 code page 865 (Nordic).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convert 8 bit characters to 7 bit space.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Keep Byte Order Mark (\s-1BOM\s0). When the input file has a \s-1BOM,\s0 write a \s-1BOM\s0 in
the output file. This is the default behavior when converting to \s-1DOS\s0 line
breaks. See also option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Set conversion mode. Where \s-1CONVMODE\s0 is one of:
\&\fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR
with ascii being the default.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force conversion of binary files.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8,\s0 regardless of the
locale setting. Use this option to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0 This option
is only available on Windows. See also section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Display help and exit.
.IP "\fB\-i[\s-1FLAGS\s0], \-\-info[=FLAGS] \s-1FILE ...\s0\fR" 4
.IX Item "-i[FLAGS], --info[=FLAGS] FILE ..."
Display file information. No conversion is done.
.Sp
The following information is printed, in this order: number of \s-1DOS\s0 line breaks,
number of Unix line breaks, number of Mac line breaks, byte order mark, text
or binary, file name.
.Sp
Example output:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionally extra flags can be set to change the output. One or more flags
can be added.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Print number of \s-1DOS\s0 line breaks.
.IP "\fBu\fR" 4
.IX Item "u"
Print number of Unix line breaks.
.IP "\fBm\fR" 4
.IX Item "m"
Print number of Mac line breaks.
.IP "\fBb\fR" 4
.IX Item "b"
Print the byte order mark.
.IP "\fBt\fR" 4
.IX Item "t"
Print if file is text or binary.
.IP "\fBc\fR" 4
.IX Item "c"
Print only the files that would be converted.
.Sp
With the \f(CW\*(C`c\*(C'\fR flag dos2unix will print only the files that contain \s-1DOS\s0 line breaks,
unix2dos will print only file names that have Unix line breaks.
.RE
.RS 4
.Sp
Examples:
.Sp
Show information for all *.txt files:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Show only the number of \s-1DOS\s0 line breaks and Unix line breaks:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Show only the byte order mark:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
List the files that have \s-1DOS\s0 line breaks:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
List the files that have Unix line breaks:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Keep the date stamp of output file same as input file.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Display program's license.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Add additional newline.
.Sp
\&\fBdos2unix\fR: Only \s-1DOS\s0 line breaks are changed to two Unix line breaks.
In Mac mode only Mac line breaks are changed to two Unix
line breaks.
.Sp
\&\fBunix2dos\fR: Only Unix line breaks are changed to two \s-1DOS\s0 line breaks.
In Mac mode Unix line breaks are changed to two Mac line breaks.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Write a Byte Order Mark (\s-1BOM\s0) in the output file. By default an \s-1UTF\-8 BOM\s0
is written.
.Sp
When the input file is \s-1UTF\-16,\s0 and the option \f(CW\*(C`\-u\*(C'\fR is used, an \s-1UTF\-16
BOM\s0 will be written.
.Sp
Never use this option when the output encoding is other than \s-1UTF\-8\s0 or \s-1UTF\-16.\s0
See also section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1INFILE OUTFILE ...\s0\fR" 4
.IX Item "-n, --newfile INFILE OUTFILE ..."
New file mode. Convert file \s-1INFILE\s0 and write output to file \s-1OUTFILE.\s0
File names must be given in pairs and wildcard names should \fInot\fR be
used or you \fIwill\fR lose your files.
.Sp
The person who starts the conversion in new file (paired) mode will be the owner
of the converted file. The read/write permissions of the new file will be the
permissions of the original file minus the \fIumask\fR\|(1) of the person who runs the
conversion.
.IP "\fB\-o, \-\-oldfile \s-1FILE ...\s0\fR" 4
.IX Item "-o, --oldfile FILE ..."
Old file mode. Convert file \s-1FILE\s0 and overwrite output to it. The program
defaults to run in this mode. Wildcard names may be used.
.Sp
In old file (in-place) mode the converted file gets the same owner, group, and
read/write permissions as the original file. Also when the file is converted by
another user who has write permissions on the file (e.g. user root). The
conversion will be aborted when it is not possible to preserve the original
values. Change of owner could mean that the original owner is not able to read
the file any more. Change of group could be a security risk, the file could be
made readable for persons for whom it is not intended. Preservation of owner,
group, and read/write permissions is only supported on Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Quiet mode. Suppress all warnings and messages. The return value is zero.
Except when wrong command-line options are used.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Remove Byte Order Mark (\s-1BOM\s0). Do not write a \s-1BOM\s0 in the output file.
This is the default behavior when converting to Unix line breaks.
See also option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Skip binary files (default).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Keep the original \s-1UTF\-16\s0 encoding of the input file. The output file will be
written in the same \s-1UTF\-16\s0 encoding, little or big endian, as the input file.
This prevents transformation to \s-1UTF\-8.\s0 An \s-1UTF\-16 BOM\s0 will be written
accordingly. This option can be disabled with the \f(CW\*(C`\-ascii\*(C'\fR option.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Assume that the input file format is \s-1UTF\-16LE.\s0
.Sp
When there is a Byte Order Mark in the input file the \s-1BOM\s0 has priority over
this option.
.Sp
When you made a wrong assumption (the input file was not in \s-1UTF\-16LE\s0 format) and
the conversion succeeded, you will get an \s-1UTF\-8\s0 output file with wrong text.
You can undo the wrong conversion with \fIiconv\fR\|(1) by converting the \s-1UTF\-8\s0 output
file back to \s-1UTF\-16LE.\s0 This will bring back the original file.
.Sp
The assumption of \s-1UTF\-16LE\s0 works as a \fIconversion mode\fR. By switching to the default
\&\fIascii\fR mode the \s-1UTF\-16LE\s0 assumption is turned off.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Assume that the input file format is \s-1UTF\-16BE.\s0
.Sp
This option works the same as option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Display verbose messages. Extra information is displayed about Byte Order Marks
and the amount of converted line breaks.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Follow symbolic links and convert the targets.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Replace symbolic links with converted files
(original target files remain unchanged).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Keep symbolic links and targets unchanged (default).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Display version information and exit.
.SH "MAC MODE"
.IX Header "MAC MODE"
In normal mode line breaks are converted from \s-1DOS\s0 to Unix and vice versa.
Mac line breaks are not converted.
.PP
In Mac mode line breaks are converted from Mac to Unix and vice versa. \s-1DOS\s0
line breaks are not changed.
.PP
To run in Mac mode use the command-line option \f(CW\*(C`\-c mac\*(C'\fR or use the
commands \f(CW\*(C`mac2unix\*(C'\fR or \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSION MODES"
.IX Header "CONVERSION MODES"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In mode \f(CW\*(C`ascii\*(C'\fR only line breaks are converted. This is the default conversion
mode.
.Sp
Although the name of this mode is \s-1ASCII,\s0 which is a 7 bit standard, the
actual mode is 8 bit. Use always this mode when converting Unicode \s-1UTF\-8\s0
files.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In this mode all 8 bit non-ASCII characters (with values from 128 to 255)
are converted to a 7 bit space.
.IP "\fBiso\fR" 4
.IX Item "iso"
Characters are converted between a \s-1DOS\s0 character set (code page) and \s-1ISO\s0
character set \s-1ISO\-8859\-1 \s0(Latin\-1) on Unix. \s-1DOS\s0 characters without \s-1ISO\-8859\-1\s0
equivalent, for which conversion is not possible, are converted to a dot. The
same counts for \s-1ISO\-8859\-1\s0 characters without \s-1DOS\s0 counterpart.
.Sp
When only option \f(CW\*(C`\-iso\*(C'\fR is used dos2unix will try to determine the active code
page. When this is not possible dos2unix will use default code page \s-1CP437,\s0
which is mainly used in the \s-1USA. \s0 To force a specific code page use options
\&\f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Western European), \f(CW\*(C`\-860\*(C'\fR (Portuguese), \f(CW\*(C`\-863\*(C'\fR (French
Canadian), or \f(CW\*(C`\-865\*(C'\fR (Nordic). Windows code page \s-1CP1252 \s0(Western European) is
also supported with option \f(CW\*(C`\-1252\*(C'\fR. For other code pages use dos2unix in
combination with \fIiconv\fR\|(1). Iconv can convert between a long list of character
encodings.
.Sp
Never use \s-1ISO\s0 conversion on Unicode text files. It will corrupt \s-1UTF\-8\s0 encoded files.
.Sp
Some examples:
.Sp
Convert from \s-1DOS\s0 default code page to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from \s-1DOS CP850\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS\s0 default code page:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix \s-1UTF\-8 \s0(Unicode) to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
See also <http://czyborra.com/charsets/codepages.html>
and <http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Encodings"
.IX Subsection "Encodings"
There exist different Unicode encodings. On Unix and Linux Unicode files are
typically encoded in \s-1UTF\-8\s0 encoding. On Windows Unicode text files can be
encoded in \s-1UTF\-8, UTF\-16,\s0 or \s-1UTF\-16\s0 big endian, but are mostly encoded in
\&\s-1UTF\-16\s0 format.
.SS "Conversion"
.IX Subsection "Conversion"
Unicode text files can have \s-1DOS,\s0 Unix or Mac line breaks, like regular text
files.
.PP
All versions of dos2unix and unix2dos can convert \s-1UTF\-8\s0 encoded files, because
\&\s-1UTF\-8\s0 was designed for backward compatibility with \s-1ASCII.\s0
.PP
Dos2unix and unix2dos with Unicode \s-1UTF\-16\s0 support, can read little and big
endian \s-1UTF\-16\s0 encoded text files. To see if dos2unix was built with \s-1UTF\-16\s0
support type \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
On Unix/Linux \s-1UTF\-16\s0 encoded files are converted to the locale character
encoding. Use the \fIlocale\fR\|(1) command to find out what the locale character
encoding is. When conversion is not possible a conversion error will occur and
the file will be skipped.
.PP
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8. UTF\-8\s0 formatted
text files are well supported on both Windows and Unix/Linux.
.PP
\&\s-1UTF\-16\s0 and \s-1UTF\-8\s0 encoding are fully compatible, there will no text be lost in
the conversion. When an \s-1UTF\-16\s0 to \s-1UTF\-8\s0 conversion error occurs, for instance
when the \s-1UTF\-16\s0 input file contains an error, the file will be skipped.
.PP
When option \f(CW\*(C`\-u\*(C'\fR is used, the output file will be written in the same \s-1UTF\-16\s0
encoding as the input file. Option \f(CW\*(C`\-u\*(C'\fR prevents conversion to \s-1UTF\-8.\s0
.PP
Dos2unix and unix2dos have no option to convert \s-1UTF\-8\s0 files to \s-1UTF\-16.\s0
.PP
\&\s-1ISO\s0 and 7\-bit mode conversion do not work on \s-1UTF\-16\s0 files.
.SS "Byte Order Mark"
.IX Subsection "Byte Order Mark"
On Windows Unicode text files typically have a Byte Order Mark (\s-1BOM\s0), because
many Windows programs (including Notepad) add BOMs by default. See also
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
On Unix Unicode files typically don't have a \s-1BOM.\s0 It is assumed that text files
are encoded in the locale character encoding.
.PP
Dos2unix can only detect if a file is in \s-1UTF\-16\s0 format if the file has a \s-1BOM.\s0
When an \s-1UTF\-16\s0 file doesn't have a \s-1BOM,\s0 dos2unix will see the file as a binary
file.
.PP
Use option \f(CW\*(C`\-ul\*(C'\fR or \f(CW\*(C`\-ub\*(C'\fR to convert an \s-1UTF\-16\s0 file without \s-1BOM.\s0
.PP
Dos2unix writes by default no \s-1BOM\s0 in the output file. With option \f(CW\*(C`\-b\*(C'\fR
Dos2unix writes a \s-1BOM\s0 when the input file has a \s-1BOM.\s0
.PP
Unix2dos writes by default a \s-1BOM\s0 in the output file when the input file has a
\&\s-1BOM.\s0 Use option \f(CW\*(C`\-r\*(C'\fR to remove the \s-1BOM.\s0
.PP
Dos2unix and unix2dos write always a \s-1BOM\s0 when option \f(CW\*(C`\-m\*(C'\fR is used.
.SS "Unicode examples"
.IX Subsection "Unicode examples"
Convert from Windows \s-1UTF\-16 \s0(with \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convert from Windows \s-1UTF\-16LE \s0(without \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-8\s0 with \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is a Chinese government standard. A mandatory subset of the \s-1GB18030\s0
standard is officially required for all software products sold in China. See
also <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is fully compatible with Unicode, and can be considered an unicode
transformation format. Like \s-1UTF\-8, GB18030\s0 is compatible with \s-1ASCII. GB18030\s0
is also compatible with Windows code page 936, also known as \s-1GBK.\s0
.PP
On Unix/Linux \s-1UTF\-16\s0 files are converted to \s-1GB18030\s0 when the locale encoding is
set to \s-1GB18030.\s0 Note that this will only work if the location is set to China.
E.g. in an English British locale setting \f(CW\*(C`en_GB.GB18030\*(C'\fR conversion of \s-1UTF\-16\s0
to \s-1GB18030\s0 will not work, but in a Chinese \f(CW\*(C`zh_CN.GB18030\*(C'\fR locale setting it
will work.
.PP
On Windows you need to use option \f(CW\*(C`\-gb\*(C'\fR to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0
.PP
\&\s-1GB18030\s0 encoded files can have a Byte Order Mark, like Unicode files.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Read input from 'stdin' and write output to 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convert and replace a.txt. Convert and replace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode,
convert and replace b.txt in 7bit conversion mode:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convert a.txt from Mac to Unix format:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convert a.txt from Unix to Mac format:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convert and replace a.txt while keeping original date stamp:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convert a.txt and write to e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convert and replace a.txt, convert b.txt and write to e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convert c.txt and write to e.txt, convert and replace a.txt,
convert and replace b.txt, convert d.txt and write to f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIVE CONVERSION"
.IX Header "RECURSIVE CONVERSION"
Use dos2unix in combination with the \fIfind\fR\|(1) and \fIxargs\fR\|(1) commands to
recursively convert text files in a directory tree structure. For instance to
convert all .txt files in the directory tree under the current directory type:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZATION"
.IX Header "LOCALIZATION"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
The primary language is selected with the environment variable \s-1LANG.\s0 The \s-1LANG\s0
variable consists out of several parts. The first part is in small letters the
language code. The second is optional and is the country code in capital
letters, preceded with an underscore. There is also an optional third part:
character encoding, preceded with a dot. A few examples for \s-1POSIX\s0 standard type
shells:
.Sp
.Vb 7
\& export LANG=nl Dutch
\& export LANG=nl_NL Dutch, The Netherlands
\& export LANG=nl_BE Dutch, Belgium
\& export LANG=es_ES Spanish, Spain
\& export LANG=es_MX Spanish, Mexico
\& export LANG=en_US.iso88591 English, USA, Latin\-1 encoding
\& export LANG=en_GB.UTF\-8 English, UK, UTF\-8 encoding
.Ve
.Sp
For a complete list of language and country codes see the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
On Unix systems you can use the command \fIlocale\fR\|(1) to get locale specific
information.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
With the \s-1LANGUAGE\s0 environment variable you can specify a priority list of
languages, separated by colons. Dos2unix gives preference to \s-1LANGUAGE\s0 over \s-1LANG.\s0
For instance, first Dutch and then German: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. You have to first
enable localization, by setting \s-1LANG \s0(or \s-1LC_ALL\s0) to a value other than
\&\*(L"C\*(R", before you can use a language priority list through the \s-1LANGUAGE\s0
variable. See also the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
If you select a language which is not available you will get the
standard English messages.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
With the environment variable \s-1DOS2UNIX_LOCALEDIR\s0 the \s-1LOCALEDIR\s0 set
during compilation can be overruled. \s-1LOCALEDIR\s0 is used to find the
language files. The \s-1GNU\s0 default value is \f(CW\*(C`/usr/local/share/locale\*(C'\fR.
Option \fB\-\-version\fR will display the \s-1LOCALEDIR\s0 that is used.
.Sp
Example (\s-1POSIX\s0 shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
On success, zero is returned. When a system error occurs the last system error will be
returned. For other errors 1 is returned.
.PP
The return value is always zero in quiet mode, except when wrong command-line options
are used.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTHORS"
.IX Header "AUTHORS"
Benjamin Lin \- <blin@socs.uts.edu.au>,
Bernd Johannes Wuebben (mac2unix mode) \- <wuebben@kde.org>,
Christian Wurll (add extra newline) \- <wurll@ira.uka.de>,
Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge page: <http://sourceforge.net/projects/dos2unix/>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIfile\fR\|(1)
\&\fIfind\fR\|(1)
\&\fIiconv\fR\|(1)
\&\fIlocale\fR\|(1)
\&\fIxargs\fR\|(1)

View File

@@ -1,730 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-01-02" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
dos2unix \- DOS/Mac to Unix and vice versa text file format converter
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FILE ...] [\-n INFILE OUTFILE ...]
\& unix2dos [options] [FILE ...] [\-n INFILE OUTFILE ...]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The Dos2unix package includes utilities \f(CW\*(C`dos2unix\*(C'\fR and \f(CW\*(C`unix2dos\*(C'\fR to convert
plain text files in \s-1DOS\s0 or Mac format to Unix format and vice versa.
.PP
In DOS/Windows text files a line break, also known as newline, is a combination
of two characters: a Carriage Return (\s-1CR\s0) followed by a Line Feed (\s-1LF\s0). In Unix
text files a line break is a single character: the Line Feed (\s-1LF\s0). In Mac text
files, prior to Mac \s-1OS X,\s0 a line break was single Carriage Return (\s-1CR\s0)
character. Nowadays Mac \s-1OS\s0 uses Unix style (\s-1LF\s0) line breaks.
.PP
Besides line breaks Dos2unix can also convert the encoding of files. A few
\&\s-1DOS\s0 code pages can be converted to Unix Latin\-1. And Windows Unicode (\s-1UTF\-16\s0)
files can be converted to Unix Unicode (\s-1UTF\-8\s0) files.
.PP
Binary files are automatically skipped, unless conversion is forced.
.PP
Non-regular files, such as directories and FIFOs, are automatically skipped.
.PP
Symbolic links and their targets are by default kept untouched. Symbolic links
can optionally be replaced, or the output can be written to the symbolic link
target. Writing to a symbolic link target is not supported on Windows.
.PP
Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
important difference with the original SunOS/Solaris version. This version does
by default in-place conversion (old file mode), while the original
SunOS/Solaris version only supports paired conversion (new file mode). See also
options \f(CW\*(C`\-o\*(C'\fR and \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Treat all following options as file names. Use this option if you want to
convert files whose names start with a dash. For instance to convert
a file named \*(L"\-foo\*(R", you can use this command:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Or in new file mode:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convert only line breaks. This is the default conversion mode.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversion between \s-1DOS\s0 and \s-1ISO\-8859\-1\s0 character set. See also section
\&\s-1CONVERSION MODES.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Use Windows code page 1252 (Western European).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Use \s-1DOS\s0 code page 437 (\s-1US\s0). This is the default code page used for \s-1ISO\s0 conversion.
.IP "\fB\-850\fR" 4
.IX Item "-850"
Use \s-1DOS\s0 code page 850 (Western European).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Use \s-1DOS\s0 code page 860 (Portuguese).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Use \s-1DOS\s0 code page 863 (French Canadian).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Use \s-1DOS\s0 code page 865 (Nordic).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convert 8 bit characters to 7 bit space.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Keep Byte Order Mark (\s-1BOM\s0). When the input file has a \s-1BOM,\s0 write a \s-1BOM\s0 in
the output file. This is the default behavior when converting to \s-1DOS\s0 line
breaks. See also option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Set conversion mode. Where \s-1CONVMODE\s0 is one of:
\&\fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR
with ascii being the default.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force conversion of binary files.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8,\s0 regardless of the
locale setting. Use this option to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0 This option
is only available on Windows. See also section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Display help and exit.
.IP "\fB\-i[\s-1FLAGS\s0], \-\-info[=FLAGS] \s-1FILE ...\s0\fR" 4
.IX Item "-i[FLAGS], --info[=FLAGS] FILE ..."
Display file information. No conversion is done.
.Sp
The following information is printed, in this order: number of \s-1DOS\s0 line breaks,
number of Unix line breaks, number of Mac line breaks, byte order mark, text
or binary, file name.
.Sp
Example output:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionally extra flags can be set to change the output. One or more flags
can be added.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Print number of \s-1DOS\s0 line breaks.
.IP "\fBu\fR" 4
.IX Item "u"
Print number of Unix line breaks.
.IP "\fBm\fR" 4
.IX Item "m"
Print number of Mac line breaks.
.IP "\fBb\fR" 4
.IX Item "b"
Print the byte order mark.
.IP "\fBt\fR" 4
.IX Item "t"
Print if file is text or binary.
.IP "\fBc\fR" 4
.IX Item "c"
Print only the files that would be converted.
.Sp
With the \f(CW\*(C`c\*(C'\fR flag dos2unix will print only the files that contain \s-1DOS\s0 line breaks,
unix2dos will print only file names that have Unix line breaks.
.RE
.RS 4
.Sp
Examples:
.Sp
Show information for all *.txt files:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Show only the number of \s-1DOS\s0 line breaks and Unix line breaks:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Show only the byte order mark:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
List the files that have \s-1DOS\s0 line breaks:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
List the files that have Unix line breaks:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Keep the date stamp of output file same as input file.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Display program's license.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Add additional newline.
.Sp
\&\fBdos2unix\fR: Only \s-1DOS\s0 line breaks are changed to two Unix line breaks.
In Mac mode only Mac line breaks are changed to two Unix
line breaks.
.Sp
\&\fBunix2dos\fR: Only Unix line breaks are changed to two \s-1DOS\s0 line breaks.
In Mac mode Unix line breaks are changed to two Mac line breaks.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Write a Byte Order Mark (\s-1BOM\s0) in the output file. By default an \s-1UTF\-8 BOM\s0
is written.
.Sp
When the input file is \s-1UTF\-16,\s0 and the option \f(CW\*(C`\-u\*(C'\fR is used, an \s-1UTF\-16
BOM\s0 will be written.
.Sp
Never use this option when the output encoding is other than \s-1UTF\-8\s0 or \s-1UTF\-16.\s0
See also section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1INFILE OUTFILE ...\s0\fR" 4
.IX Item "-n, --newfile INFILE OUTFILE ..."
New file mode. Convert file \s-1INFILE\s0 and write output to file \s-1OUTFILE.\s0
File names must be given in pairs and wildcard names should \fInot\fR be
used or you \fIwill\fR lose your files.
.Sp
The person who starts the conversion in new file (paired) mode will be the owner
of the converted file. The read/write permissions of the new file will be the
permissions of the original file minus the \fIumask\fR\|(1) of the person who runs the
conversion.
.IP "\fB\-o, \-\-oldfile \s-1FILE ...\s0\fR" 4
.IX Item "-o, --oldfile FILE ..."
Old file mode. Convert file \s-1FILE\s0 and overwrite output to it. The program
defaults to run in this mode. Wildcard names may be used.
.Sp
In old file (in-place) mode the converted file gets the same owner, group, and
read/write permissions as the original file. Also when the file is converted by
another user who has write permissions on the file (e.g. user root). The
conversion will be aborted when it is not possible to preserve the original
values. Change of owner could mean that the original owner is not able to read
the file any more. Change of group could be a security risk, the file could be
made readable for persons for whom it is not intended. Preservation of owner,
group, and read/write permissions is only supported on Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Quiet mode. Suppress all warnings and messages. The return value is zero.
Except when wrong command-line options are used.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Remove Byte Order Mark (\s-1BOM\s0). Do not write a \s-1BOM\s0 in the output file.
This is the default behavior when converting to Unix line breaks.
See also option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Skip binary files (default).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Keep the original \s-1UTF\-16\s0 encoding of the input file. The output file will be
written in the same \s-1UTF\-16\s0 encoding, little or big endian, as the input file.
This prevents transformation to \s-1UTF\-8.\s0 An \s-1UTF\-16 BOM\s0 will be written
accordingly. This option can be disabled with the \f(CW\*(C`\-ascii\*(C'\fR option.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Assume that the input file format is \s-1UTF\-16LE.\s0
.Sp
When there is a Byte Order Mark in the input file the \s-1BOM\s0 has priority over
this option.
.Sp
When you made a wrong assumption (the input file was not in \s-1UTF\-16LE\s0 format) and
the conversion succeeded, you will get an \s-1UTF\-8\s0 output file with wrong text.
You can undo the wrong conversion with \fIiconv\fR\|(1) by converting the \s-1UTF\-8\s0 output
file back to \s-1UTF\-16LE.\s0 This will bring back the original file.
.Sp
The assumption of \s-1UTF\-16LE\s0 works as a \fIconversion mode\fR. By switching to the default
\&\fIascii\fR mode the \s-1UTF\-16LE\s0 assumption is turned off.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Assume that the input file format is \s-1UTF\-16BE.\s0
.Sp
This option works the same as option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Display verbose messages. Extra information is displayed about Byte Order Marks
and the amount of converted line breaks.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Follow symbolic links and convert the targets.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Replace symbolic links with converted files
(original target files remain unchanged).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Keep symbolic links and targets unchanged (default).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Display version information and exit.
.SH "MAC MODE"
.IX Header "MAC MODE"
In normal mode line breaks are converted from \s-1DOS\s0 to Unix and vice versa.
Mac line breaks are not converted.
.PP
In Mac mode line breaks are converted from Mac to Unix and vice versa. \s-1DOS\s0
line breaks are not changed.
.PP
To run in Mac mode use the command-line option \f(CW\*(C`\-c mac\*(C'\fR or use the
commands \f(CW\*(C`mac2unix\*(C'\fR or \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSION MODES"
.IX Header "CONVERSION MODES"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In mode \f(CW\*(C`ascii\*(C'\fR only line breaks are converted. This is the default conversion
mode.
.Sp
Although the name of this mode is \s-1ASCII,\s0 which is a 7 bit standard, the
actual mode is 8 bit. Use always this mode when converting Unicode \s-1UTF\-8\s0
files.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In this mode all 8 bit non-ASCII characters (with values from 128 to 255)
are converted to a 7 bit space.
.IP "\fBiso\fR" 4
.IX Item "iso"
Characters are converted between a \s-1DOS\s0 character set (code page) and \s-1ISO\s0
character set \s-1ISO\-8859\-1 \s0(Latin\-1) on Unix. \s-1DOS\s0 characters without \s-1ISO\-8859\-1\s0
equivalent, for which conversion is not possible, are converted to a dot. The
same counts for \s-1ISO\-8859\-1\s0 characters without \s-1DOS\s0 counterpart.
.Sp
When only option \f(CW\*(C`\-iso\*(C'\fR is used dos2unix will try to determine the active code
page. When this is not possible dos2unix will use default code page \s-1CP437,\s0
which is mainly used in the \s-1USA. \s0 To force a specific code page use options
\&\f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Western European), \f(CW\*(C`\-860\*(C'\fR (Portuguese), \f(CW\*(C`\-863\*(C'\fR (French
Canadian), or \f(CW\*(C`\-865\*(C'\fR (Nordic). Windows code page \s-1CP1252 \s0(Western European) is
also supported with option \f(CW\*(C`\-1252\*(C'\fR. For other code pages use dos2unix in
combination with \fIiconv\fR\|(1). Iconv can convert between a long list of character
encodings.
.Sp
Never use \s-1ISO\s0 conversion on Unicode text files. It will corrupt \s-1UTF\-8\s0 encoded files.
.Sp
Some examples:
.Sp
Convert from \s-1DOS\s0 default code page to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from \s-1DOS CP850\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS\s0 default code page:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix \s-1UTF\-8 \s0(Unicode) to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
See also <http://czyborra.com/charsets/codepages.html>
and <http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Encodings"
.IX Subsection "Encodings"
There exist different Unicode encodings. On Unix and Linux Unicode files are
typically encoded in \s-1UTF\-8\s0 encoding. On Windows Unicode text files can be
encoded in \s-1UTF\-8, UTF\-16,\s0 or \s-1UTF\-16\s0 big endian, but are mostly encoded in
\&\s-1UTF\-16\s0 format.
.SS "Conversion"
.IX Subsection "Conversion"
Unicode text files can have \s-1DOS,\s0 Unix or Mac line breaks, like regular text
files.
.PP
All versions of dos2unix and unix2dos can convert \s-1UTF\-8\s0 encoded files, because
\&\s-1UTF\-8\s0 was designed for backward compatibility with \s-1ASCII.\s0
.PP
Dos2unix and unix2dos with Unicode \s-1UTF\-16\s0 support, can read little and big
endian \s-1UTF\-16\s0 encoded text files. To see if dos2unix was built with \s-1UTF\-16\s0
support type \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
On Unix/Linux \s-1UTF\-16\s0 encoded files are converted to the locale character
encoding. Use the \fIlocale\fR\|(1) command to find out what the locale character
encoding is. When conversion is not possible a conversion error will occur and
the file will be skipped.
.PP
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8. UTF\-8\s0 formatted
text files are well supported on both Windows and Unix/Linux.
.PP
\&\s-1UTF\-16\s0 and \s-1UTF\-8\s0 encoding are fully compatible, there will no text be lost in
the conversion. When an \s-1UTF\-16\s0 to \s-1UTF\-8\s0 conversion error occurs, for instance
when the \s-1UTF\-16\s0 input file contains an error, the file will be skipped.
.PP
When option \f(CW\*(C`\-u\*(C'\fR is used, the output file will be written in the same \s-1UTF\-16\s0
encoding as the input file. Option \f(CW\*(C`\-u\*(C'\fR prevents conversion to \s-1UTF\-8.\s0
.PP
Dos2unix and unix2dos have no option to convert \s-1UTF\-8\s0 files to \s-1UTF\-16.\s0
.PP
\&\s-1ISO\s0 and 7\-bit mode conversion do not work on \s-1UTF\-16\s0 files.
.SS "Byte Order Mark"
.IX Subsection "Byte Order Mark"
On Windows Unicode text files typically have a Byte Order Mark (\s-1BOM\s0), because
many Windows programs (including Notepad) add BOMs by default. See also
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
On Unix Unicode files typically don't have a \s-1BOM.\s0 It is assumed that text files
are encoded in the locale character encoding.
.PP
Dos2unix can only detect if a file is in \s-1UTF\-16\s0 format if the file has a \s-1BOM.\s0
When an \s-1UTF\-16\s0 file doesn't have a \s-1BOM,\s0 dos2unix will see the file as a binary
file.
.PP
Use option \f(CW\*(C`\-ul\*(C'\fR or \f(CW\*(C`\-ub\*(C'\fR to convert an \s-1UTF\-16\s0 file without \s-1BOM.\s0
.PP
Dos2unix writes by default no \s-1BOM\s0 in the output file. With option \f(CW\*(C`\-b\*(C'\fR
Dos2unix writes a \s-1BOM\s0 when the input file has a \s-1BOM.\s0
.PP
Unix2dos writes by default a \s-1BOM\s0 in the output file when the input file has a
\&\s-1BOM.\s0 Use option \f(CW\*(C`\-r\*(C'\fR to remove the \s-1BOM.\s0
.PP
Dos2unix and unix2dos write always a \s-1BOM\s0 when option \f(CW\*(C`\-m\*(C'\fR is used.
.SS "Unicode examples"
.IX Subsection "Unicode examples"
Convert from Windows \s-1UTF\-16 \s0(with \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convert from Windows \s-1UTF\-16LE \s0(without \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-8\s0 with \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is a Chinese government standard. A mandatory subset of the \s-1GB18030\s0
standard is officially required for all software products sold in China. See
also <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is fully compatible with Unicode, and can be considered an unicode
transformation format. Like \s-1UTF\-8, GB18030\s0 is compatible with \s-1ASCII. GB18030\s0
is also compatible with Windows code page 936, also known as \s-1GBK.\s0
.PP
On Unix/Linux \s-1UTF\-16\s0 files are converted to \s-1GB18030\s0 when the locale encoding is
set to \s-1GB18030.\s0 Note that this will only work if the location is set to China.
E.g. in an English British locale setting \f(CW\*(C`en_GB.GB18030\*(C'\fR conversion of \s-1UTF\-16\s0
to \s-1GB18030\s0 will not work, but in a Chinese \f(CW\*(C`zh_CN.GB18030\*(C'\fR locale setting it
will work.
.PP
On Windows you need to use option \f(CW\*(C`\-gb\*(C'\fR to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0
.PP
\&\s-1GB18030\s0 encoded files can have a Byte Order Mark, like Unicode files.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Read input from 'stdin' and write output to 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convert and replace a.txt. Convert and replace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode,
convert and replace b.txt in 7bit conversion mode:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convert a.txt from Mac to Unix format:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convert a.txt from Unix to Mac format:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convert and replace a.txt while keeping original date stamp:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convert a.txt and write to e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convert and replace a.txt, convert b.txt and write to e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convert c.txt and write to e.txt, convert and replace a.txt,
convert and replace b.txt, convert d.txt and write to f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIVE CONVERSION"
.IX Header "RECURSIVE CONVERSION"
Use dos2unix in combination with the \fIfind\fR\|(1) and \fIxargs\fR\|(1) commands to
recursively convert text files in a directory tree structure. For instance to
convert all .txt files in the directory tree under the current directory type:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZATION"
.IX Header "LOCALIZATION"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
The primary language is selected with the environment variable \s-1LANG.\s0 The \s-1LANG\s0
variable consists out of several parts. The first part is in small letters the
language code. The second is optional and is the country code in capital
letters, preceded with an underscore. There is also an optional third part:
character encoding, preceded with a dot. A few examples for \s-1POSIX\s0 standard type
shells:
.Sp
.Vb 7
\& export LANG=nl Dutch
\& export LANG=nl_NL Dutch, The Netherlands
\& export LANG=nl_BE Dutch, Belgium
\& export LANG=es_ES Spanish, Spain
\& export LANG=es_MX Spanish, Mexico
\& export LANG=en_US.iso88591 English, USA, Latin\-1 encoding
\& export LANG=en_GB.UTF\-8 English, UK, UTF\-8 encoding
.Ve
.Sp
For a complete list of language and country codes see the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
On Unix systems you can use the command \fIlocale\fR\|(1) to get locale specific
information.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
With the \s-1LANGUAGE\s0 environment variable you can specify a priority list of
languages, separated by colons. Dos2unix gives preference to \s-1LANGUAGE\s0 over \s-1LANG.\s0
For instance, first Dutch and then German: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. You have to first
enable localization, by setting \s-1LANG \s0(or \s-1LC_ALL\s0) to a value other than
\&\*(L"C\*(R", before you can use a language priority list through the \s-1LANGUAGE\s0
variable. See also the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
If you select a language which is not available you will get the
standard English messages.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
With the environment variable \s-1DOS2UNIX_LOCALEDIR\s0 the \s-1LOCALEDIR\s0 set
during compilation can be overruled. \s-1LOCALEDIR\s0 is used to find the
language files. The \s-1GNU\s0 default value is \f(CW\*(C`/usr/local/share/locale\*(C'\fR.
Option \fB\-\-version\fR will display the \s-1LOCALEDIR\s0 that is used.
.Sp
Example (\s-1POSIX\s0 shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
On success, zero is returned. When a system error occurs the last system error will be
returned. For other errors 1 is returned.
.PP
The return value is always zero in quiet mode, except when wrong command-line options
are used.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTHORS"
.IX Header "AUTHORS"
Benjamin Lin \- <blin@socs.uts.edu.au>,
Bernd Johannes Wuebben (mac2unix mode) \- <wuebben@kde.org>,
Christian Wurll (add extra newline) \- <wurll@ira.uka.de>,
Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge page: <http://sourceforge.net/projects/dos2unix/>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIfile\fR\|(1)
\&\fIfind\fR\|(1)
\&\fIiconv\fR\|(1)
\&\fIlocale\fR\|(1)
\&\fIxargs\fR\|(1)

View File

@@ -1,730 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-01-02" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
dos2unix \- DOS/Mac to Unix and vice versa text file format converter
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FILE ...] [\-n INFILE OUTFILE ...]
\& unix2dos [options] [FILE ...] [\-n INFILE OUTFILE ...]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The Dos2unix package includes utilities \f(CW\*(C`dos2unix\*(C'\fR and \f(CW\*(C`unix2dos\*(C'\fR to convert
plain text files in \s-1DOS\s0 or Mac format to Unix format and vice versa.
.PP
In DOS/Windows text files a line break, also known as newline, is a combination
of two characters: a Carriage Return (\s-1CR\s0) followed by a Line Feed (\s-1LF\s0). In Unix
text files a line break is a single character: the Line Feed (\s-1LF\s0). In Mac text
files, prior to Mac \s-1OS X,\s0 a line break was single Carriage Return (\s-1CR\s0)
character. Nowadays Mac \s-1OS\s0 uses Unix style (\s-1LF\s0) line breaks.
.PP
Besides line breaks Dos2unix can also convert the encoding of files. A few
\&\s-1DOS\s0 code pages can be converted to Unix Latin\-1. And Windows Unicode (\s-1UTF\-16\s0)
files can be converted to Unix Unicode (\s-1UTF\-8\s0) files.
.PP
Binary files are automatically skipped, unless conversion is forced.
.PP
Non-regular files, such as directories and FIFOs, are automatically skipped.
.PP
Symbolic links and their targets are by default kept untouched. Symbolic links
can optionally be replaced, or the output can be written to the symbolic link
target. Writing to a symbolic link target is not supported on Windows.
.PP
Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
important difference with the original SunOS/Solaris version. This version does
by default in-place conversion (old file mode), while the original
SunOS/Solaris version only supports paired conversion (new file mode). See also
options \f(CW\*(C`\-o\*(C'\fR and \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Treat all following options as file names. Use this option if you want to
convert files whose names start with a dash. For instance to convert
a file named \*(L"\-foo\*(R", you can use this command:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Or in new file mode:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convert only line breaks. This is the default conversion mode.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversion between \s-1DOS\s0 and \s-1ISO\-8859\-1\s0 character set. See also section
\&\s-1CONVERSION MODES.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Use Windows code page 1252 (Western European).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Use \s-1DOS\s0 code page 437 (\s-1US\s0). This is the default code page used for \s-1ISO\s0 conversion.
.IP "\fB\-850\fR" 4
.IX Item "-850"
Use \s-1DOS\s0 code page 850 (Western European).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Use \s-1DOS\s0 code page 860 (Portuguese).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Use \s-1DOS\s0 code page 863 (French Canadian).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Use \s-1DOS\s0 code page 865 (Nordic).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convert 8 bit characters to 7 bit space.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Keep Byte Order Mark (\s-1BOM\s0). When the input file has a \s-1BOM,\s0 write a \s-1BOM\s0 in
the output file. This is the default behavior when converting to \s-1DOS\s0 line
breaks. See also option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Set conversion mode. Where \s-1CONVMODE\s0 is one of:
\&\fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR
with ascii being the default.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force conversion of binary files.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8,\s0 regardless of the
locale setting. Use this option to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0 This option
is only available on Windows. See also section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Display help and exit.
.IP "\fB\-i[\s-1FLAGS\s0], \-\-info[=FLAGS] \s-1FILE ...\s0\fR" 4
.IX Item "-i[FLAGS], --info[=FLAGS] FILE ..."
Display file information. No conversion is done.
.Sp
The following information is printed, in this order: number of \s-1DOS\s0 line breaks,
number of Unix line breaks, number of Mac line breaks, byte order mark, text
or binary, file name.
.Sp
Example output:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionally extra flags can be set to change the output. One or more flags
can be added.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Print number of \s-1DOS\s0 line breaks.
.IP "\fBu\fR" 4
.IX Item "u"
Print number of Unix line breaks.
.IP "\fBm\fR" 4
.IX Item "m"
Print number of Mac line breaks.
.IP "\fBb\fR" 4
.IX Item "b"
Print the byte order mark.
.IP "\fBt\fR" 4
.IX Item "t"
Print if file is text or binary.
.IP "\fBc\fR" 4
.IX Item "c"
Print only the files that would be converted.
.Sp
With the \f(CW\*(C`c\*(C'\fR flag dos2unix will print only the files that contain \s-1DOS\s0 line breaks,
unix2dos will print only file names that have Unix line breaks.
.RE
.RS 4
.Sp
Examples:
.Sp
Show information for all *.txt files:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Show only the number of \s-1DOS\s0 line breaks and Unix line breaks:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Show only the byte order mark:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
List the files that have \s-1DOS\s0 line breaks:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
List the files that have Unix line breaks:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Keep the date stamp of output file same as input file.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Display program's license.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Add additional newline.
.Sp
\&\fBdos2unix\fR: Only \s-1DOS\s0 line breaks are changed to two Unix line breaks.
In Mac mode only Mac line breaks are changed to two Unix
line breaks.
.Sp
\&\fBunix2dos\fR: Only Unix line breaks are changed to two \s-1DOS\s0 line breaks.
In Mac mode Unix line breaks are changed to two Mac line breaks.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Write a Byte Order Mark (\s-1BOM\s0) in the output file. By default an \s-1UTF\-8 BOM\s0
is written.
.Sp
When the input file is \s-1UTF\-16,\s0 and the option \f(CW\*(C`\-u\*(C'\fR is used, an \s-1UTF\-16
BOM\s0 will be written.
.Sp
Never use this option when the output encoding is other than \s-1UTF\-8\s0 or \s-1UTF\-16.\s0
See also section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1INFILE OUTFILE ...\s0\fR" 4
.IX Item "-n, --newfile INFILE OUTFILE ..."
New file mode. Convert file \s-1INFILE\s0 and write output to file \s-1OUTFILE.\s0
File names must be given in pairs and wildcard names should \fInot\fR be
used or you \fIwill\fR lose your files.
.Sp
The person who starts the conversion in new file (paired) mode will be the owner
of the converted file. The read/write permissions of the new file will be the
permissions of the original file minus the \fIumask\fR\|(1) of the person who runs the
conversion.
.IP "\fB\-o, \-\-oldfile \s-1FILE ...\s0\fR" 4
.IX Item "-o, --oldfile FILE ..."
Old file mode. Convert file \s-1FILE\s0 and overwrite output to it. The program
defaults to run in this mode. Wildcard names may be used.
.Sp
In old file (in-place) mode the converted file gets the same owner, group, and
read/write permissions as the original file. Also when the file is converted by
another user who has write permissions on the file (e.g. user root). The
conversion will be aborted when it is not possible to preserve the original
values. Change of owner could mean that the original owner is not able to read
the file any more. Change of group could be a security risk, the file could be
made readable for persons for whom it is not intended. Preservation of owner,
group, and read/write permissions is only supported on Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Quiet mode. Suppress all warnings and messages. The return value is zero.
Except when wrong command-line options are used.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Remove Byte Order Mark (\s-1BOM\s0). Do not write a \s-1BOM\s0 in the output file.
This is the default behavior when converting to Unix line breaks.
See also option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Skip binary files (default).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Keep the original \s-1UTF\-16\s0 encoding of the input file. The output file will be
written in the same \s-1UTF\-16\s0 encoding, little or big endian, as the input file.
This prevents transformation to \s-1UTF\-8.\s0 An \s-1UTF\-16 BOM\s0 will be written
accordingly. This option can be disabled with the \f(CW\*(C`\-ascii\*(C'\fR option.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Assume that the input file format is \s-1UTF\-16LE.\s0
.Sp
When there is a Byte Order Mark in the input file the \s-1BOM\s0 has priority over
this option.
.Sp
When you made a wrong assumption (the input file was not in \s-1UTF\-16LE\s0 format) and
the conversion succeeded, you will get an \s-1UTF\-8\s0 output file with wrong text.
You can undo the wrong conversion with \fIiconv\fR\|(1) by converting the \s-1UTF\-8\s0 output
file back to \s-1UTF\-16LE.\s0 This will bring back the original file.
.Sp
The assumption of \s-1UTF\-16LE\s0 works as a \fIconversion mode\fR. By switching to the default
\&\fIascii\fR mode the \s-1UTF\-16LE\s0 assumption is turned off.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Assume that the input file format is \s-1UTF\-16BE.\s0
.Sp
This option works the same as option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Display verbose messages. Extra information is displayed about Byte Order Marks
and the amount of converted line breaks.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Follow symbolic links and convert the targets.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Replace symbolic links with converted files
(original target files remain unchanged).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Keep symbolic links and targets unchanged (default).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Display version information and exit.
.SH "MAC MODE"
.IX Header "MAC MODE"
In normal mode line breaks are converted from \s-1DOS\s0 to Unix and vice versa.
Mac line breaks are not converted.
.PP
In Mac mode line breaks are converted from Mac to Unix and vice versa. \s-1DOS\s0
line breaks are not changed.
.PP
To run in Mac mode use the command-line option \f(CW\*(C`\-c mac\*(C'\fR or use the
commands \f(CW\*(C`mac2unix\*(C'\fR or \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSION MODES"
.IX Header "CONVERSION MODES"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In mode \f(CW\*(C`ascii\*(C'\fR only line breaks are converted. This is the default conversion
mode.
.Sp
Although the name of this mode is \s-1ASCII,\s0 which is a 7 bit standard, the
actual mode is 8 bit. Use always this mode when converting Unicode \s-1UTF\-8\s0
files.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In this mode all 8 bit non-ASCII characters (with values from 128 to 255)
are converted to a 7 bit space.
.IP "\fBiso\fR" 4
.IX Item "iso"
Characters are converted between a \s-1DOS\s0 character set (code page) and \s-1ISO\s0
character set \s-1ISO\-8859\-1 \s0(Latin\-1) on Unix. \s-1DOS\s0 characters without \s-1ISO\-8859\-1\s0
equivalent, for which conversion is not possible, are converted to a dot. The
same counts for \s-1ISO\-8859\-1\s0 characters without \s-1DOS\s0 counterpart.
.Sp
When only option \f(CW\*(C`\-iso\*(C'\fR is used dos2unix will try to determine the active code
page. When this is not possible dos2unix will use default code page \s-1CP437,\s0
which is mainly used in the \s-1USA. \s0 To force a specific code page use options
\&\f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Western European), \f(CW\*(C`\-860\*(C'\fR (Portuguese), \f(CW\*(C`\-863\*(C'\fR (French
Canadian), or \f(CW\*(C`\-865\*(C'\fR (Nordic). Windows code page \s-1CP1252 \s0(Western European) is
also supported with option \f(CW\*(C`\-1252\*(C'\fR. For other code pages use dos2unix in
combination with \fIiconv\fR\|(1). Iconv can convert between a long list of character
encodings.
.Sp
Never use \s-1ISO\s0 conversion on Unicode text files. It will corrupt \s-1UTF\-8\s0 encoded files.
.Sp
Some examples:
.Sp
Convert from \s-1DOS\s0 default code page to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from \s-1DOS CP850\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS\s0 default code page:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix \s-1UTF\-8 \s0(Unicode) to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
See also <http://czyborra.com/charsets/codepages.html>
and <http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Encodings"
.IX Subsection "Encodings"
There exist different Unicode encodings. On Unix and Linux Unicode files are
typically encoded in \s-1UTF\-8\s0 encoding. On Windows Unicode text files can be
encoded in \s-1UTF\-8, UTF\-16,\s0 or \s-1UTF\-16\s0 big endian, but are mostly encoded in
\&\s-1UTF\-16\s0 format.
.SS "Conversion"
.IX Subsection "Conversion"
Unicode text files can have \s-1DOS,\s0 Unix or Mac line breaks, like regular text
files.
.PP
All versions of dos2unix and unix2dos can convert \s-1UTF\-8\s0 encoded files, because
\&\s-1UTF\-8\s0 was designed for backward compatibility with \s-1ASCII.\s0
.PP
Dos2unix and unix2dos with Unicode \s-1UTF\-16\s0 support, can read little and big
endian \s-1UTF\-16\s0 encoded text files. To see if dos2unix was built with \s-1UTF\-16\s0
support type \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
On Unix/Linux \s-1UTF\-16\s0 encoded files are converted to the locale character
encoding. Use the \fIlocale\fR\|(1) command to find out what the locale character
encoding is. When conversion is not possible a conversion error will occur and
the file will be skipped.
.PP
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8. UTF\-8\s0 formatted
text files are well supported on both Windows and Unix/Linux.
.PP
\&\s-1UTF\-16\s0 and \s-1UTF\-8\s0 encoding are fully compatible, there will no text be lost in
the conversion. When an \s-1UTF\-16\s0 to \s-1UTF\-8\s0 conversion error occurs, for instance
when the \s-1UTF\-16\s0 input file contains an error, the file will be skipped.
.PP
When option \f(CW\*(C`\-u\*(C'\fR is used, the output file will be written in the same \s-1UTF\-16\s0
encoding as the input file. Option \f(CW\*(C`\-u\*(C'\fR prevents conversion to \s-1UTF\-8.\s0
.PP
Dos2unix and unix2dos have no option to convert \s-1UTF\-8\s0 files to \s-1UTF\-16.\s0
.PP
\&\s-1ISO\s0 and 7\-bit mode conversion do not work on \s-1UTF\-16\s0 files.
.SS "Byte Order Mark"
.IX Subsection "Byte Order Mark"
On Windows Unicode text files typically have a Byte Order Mark (\s-1BOM\s0), because
many Windows programs (including Notepad) add BOMs by default. See also
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
On Unix Unicode files typically don't have a \s-1BOM.\s0 It is assumed that text files
are encoded in the locale character encoding.
.PP
Dos2unix can only detect if a file is in \s-1UTF\-16\s0 format if the file has a \s-1BOM.\s0
When an \s-1UTF\-16\s0 file doesn't have a \s-1BOM,\s0 dos2unix will see the file as a binary
file.
.PP
Use option \f(CW\*(C`\-ul\*(C'\fR or \f(CW\*(C`\-ub\*(C'\fR to convert an \s-1UTF\-16\s0 file without \s-1BOM.\s0
.PP
Dos2unix writes by default no \s-1BOM\s0 in the output file. With option \f(CW\*(C`\-b\*(C'\fR
Dos2unix writes a \s-1BOM\s0 when the input file has a \s-1BOM.\s0
.PP
Unix2dos writes by default a \s-1BOM\s0 in the output file when the input file has a
\&\s-1BOM.\s0 Use option \f(CW\*(C`\-r\*(C'\fR to remove the \s-1BOM.\s0
.PP
Dos2unix and unix2dos write always a \s-1BOM\s0 when option \f(CW\*(C`\-m\*(C'\fR is used.
.SS "Unicode examples"
.IX Subsection "Unicode examples"
Convert from Windows \s-1UTF\-16 \s0(with \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convert from Windows \s-1UTF\-16LE \s0(without \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-8\s0 with \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is a Chinese government standard. A mandatory subset of the \s-1GB18030\s0
standard is officially required for all software products sold in China. See
also <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is fully compatible with Unicode, and can be considered an unicode
transformation format. Like \s-1UTF\-8, GB18030\s0 is compatible with \s-1ASCII. GB18030\s0
is also compatible with Windows code page 936, also known as \s-1GBK.\s0
.PP
On Unix/Linux \s-1UTF\-16\s0 files are converted to \s-1GB18030\s0 when the locale encoding is
set to \s-1GB18030.\s0 Note that this will only work if the location is set to China.
E.g. in an English British locale setting \f(CW\*(C`en_GB.GB18030\*(C'\fR conversion of \s-1UTF\-16\s0
to \s-1GB18030\s0 will not work, but in a Chinese \f(CW\*(C`zh_CN.GB18030\*(C'\fR locale setting it
will work.
.PP
On Windows you need to use option \f(CW\*(C`\-gb\*(C'\fR to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0
.PP
\&\s-1GB18030\s0 encoded files can have a Byte Order Mark, like Unicode files.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Read input from 'stdin' and write output to 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convert and replace a.txt. Convert and replace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode,
convert and replace b.txt in 7bit conversion mode:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convert a.txt from Mac to Unix format:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convert a.txt from Unix to Mac format:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convert and replace a.txt while keeping original date stamp:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convert a.txt and write to e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convert and replace a.txt, convert b.txt and write to e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convert c.txt and write to e.txt, convert and replace a.txt,
convert and replace b.txt, convert d.txt and write to f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIVE CONVERSION"
.IX Header "RECURSIVE CONVERSION"
Use dos2unix in combination with the \fIfind\fR\|(1) and \fIxargs\fR\|(1) commands to
recursively convert text files in a directory tree structure. For instance to
convert all .txt files in the directory tree under the current directory type:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZATION"
.IX Header "LOCALIZATION"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
The primary language is selected with the environment variable \s-1LANG.\s0 The \s-1LANG\s0
variable consists out of several parts. The first part is in small letters the
language code. The second is optional and is the country code in capital
letters, preceded with an underscore. There is also an optional third part:
character encoding, preceded with a dot. A few examples for \s-1POSIX\s0 standard type
shells:
.Sp
.Vb 7
\& export LANG=nl Dutch
\& export LANG=nl_NL Dutch, The Netherlands
\& export LANG=nl_BE Dutch, Belgium
\& export LANG=es_ES Spanish, Spain
\& export LANG=es_MX Spanish, Mexico
\& export LANG=en_US.iso88591 English, USA, Latin\-1 encoding
\& export LANG=en_GB.UTF\-8 English, UK, UTF\-8 encoding
.Ve
.Sp
For a complete list of language and country codes see the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
On Unix systems you can use the command \fIlocale\fR\|(1) to get locale specific
information.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
With the \s-1LANGUAGE\s0 environment variable you can specify a priority list of
languages, separated by colons. Dos2unix gives preference to \s-1LANGUAGE\s0 over \s-1LANG.\s0
For instance, first Dutch and then German: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. You have to first
enable localization, by setting \s-1LANG \s0(or \s-1LC_ALL\s0) to a value other than
\&\*(L"C\*(R", before you can use a language priority list through the \s-1LANGUAGE\s0
variable. See also the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
If you select a language which is not available you will get the
standard English messages.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
With the environment variable \s-1DOS2UNIX_LOCALEDIR\s0 the \s-1LOCALEDIR\s0 set
during compilation can be overruled. \s-1LOCALEDIR\s0 is used to find the
language files. The \s-1GNU\s0 default value is \f(CW\*(C`/usr/local/share/locale\*(C'\fR.
Option \fB\-\-version\fR will display the \s-1LOCALEDIR\s0 that is used.
.Sp
Example (\s-1POSIX\s0 shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
On success, zero is returned. When a system error occurs the last system error will be
returned. For other errors 1 is returned.
.PP
The return value is always zero in quiet mode, except when wrong command-line options
are used.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTHORS"
.IX Header "AUTHORS"
Benjamin Lin \- <blin@socs.uts.edu.au>,
Bernd Johannes Wuebben (mac2unix mode) \- <wuebben@kde.org>,
Christian Wurll (add extra newline) \- <wurll@ira.uka.de>,
Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge page: <http://sourceforge.net/projects/dos2unix/>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIfile\fR\|(1)
\&\fIfind\fR\|(1)
\&\fIiconv\fR\|(1)
\&\fIlocale\fR\|(1)
\&\fIxargs\fR\|(1)

View File

@@ -1,730 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-01-02" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
dos2unix \- DOS/Mac to Unix and vice versa text file format converter
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& dos2unix [options] [FILE ...] [\-n INFILE OUTFILE ...]
\& unix2dos [options] [FILE ...] [\-n INFILE OUTFILE ...]
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The Dos2unix package includes utilities \f(CW\*(C`dos2unix\*(C'\fR and \f(CW\*(C`unix2dos\*(C'\fR to convert
plain text files in \s-1DOS\s0 or Mac format to Unix format and vice versa.
.PP
In DOS/Windows text files a line break, also known as newline, is a combination
of two characters: a Carriage Return (\s-1CR\s0) followed by a Line Feed (\s-1LF\s0). In Unix
text files a line break is a single character: the Line Feed (\s-1LF\s0). In Mac text
files, prior to Mac \s-1OS X,\s0 a line break was single Carriage Return (\s-1CR\s0)
character. Nowadays Mac \s-1OS\s0 uses Unix style (\s-1LF\s0) line breaks.
.PP
Besides line breaks Dos2unix can also convert the encoding of files. A few
\&\s-1DOS\s0 code pages can be converted to Unix Latin\-1. And Windows Unicode (\s-1UTF\-16\s0)
files can be converted to Unix Unicode (\s-1UTF\-8\s0) files.
.PP
Binary files are automatically skipped, unless conversion is forced.
.PP
Non-regular files, such as directories and FIFOs, are automatically skipped.
.PP
Symbolic links and their targets are by default kept untouched. Symbolic links
can optionally be replaced, or the output can be written to the symbolic link
target. Writing to a symbolic link target is not supported on Windows.
.PP
Dos2unix was modelled after dos2unix under SunOS/Solaris. There is one
important difference with the original SunOS/Solaris version. This version does
by default in-place conversion (old file mode), while the original
SunOS/Solaris version only supports paired conversion (new file mode). See also
options \f(CW\*(C`\-o\*(C'\fR and \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Treat all following options as file names. Use this option if you want to
convert files whose names start with a dash. For instance to convert
a file named \*(L"\-foo\*(R", you can use this command:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Or in new file mode:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Convert only line breaks. This is the default conversion mode.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversion between \s-1DOS\s0 and \s-1ISO\-8859\-1\s0 character set. See also section
\&\s-1CONVERSION MODES.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Use Windows code page 1252 (Western European).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Use \s-1DOS\s0 code page 437 (\s-1US\s0). This is the default code page used for \s-1ISO\s0 conversion.
.IP "\fB\-850\fR" 4
.IX Item "-850"
Use \s-1DOS\s0 code page 850 (Western European).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Use \s-1DOS\s0 code page 860 (Portuguese).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Use \s-1DOS\s0 code page 863 (French Canadian).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Use \s-1DOS\s0 code page 865 (Nordic).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Convert 8 bit characters to 7 bit space.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Keep Byte Order Mark (\s-1BOM\s0). When the input file has a \s-1BOM,\s0 write a \s-1BOM\s0 in
the output file. This is the default behavior when converting to \s-1DOS\s0 line
breaks. See also option \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1CONVMODE\s0\fR" 4
.IX Item "-c, --convmode CONVMODE"
Set conversion mode. Where \s-1CONVMODE\s0 is one of:
\&\fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR
with ascii being the default.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Force conversion of binary files.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8,\s0 regardless of the
locale setting. Use this option to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0 This option
is only available on Windows. See also section \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Display help and exit.
.IP "\fB\-i[\s-1FLAGS\s0], \-\-info[=FLAGS] \s-1FILE ...\s0\fR" 4
.IX Item "-i[FLAGS], --info[=FLAGS] FILE ..."
Display file information. No conversion is done.
.Sp
The following information is printed, in this order: number of \s-1DOS\s0 line breaks,
number of Unix line breaks, number of Mac line breaks, byte order mark, text
or binary, file name.
.Sp
Example output:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Optionally extra flags can be set to change the output. One or more flags
can be added.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Print number of \s-1DOS\s0 line breaks.
.IP "\fBu\fR" 4
.IX Item "u"
Print number of Unix line breaks.
.IP "\fBm\fR" 4
.IX Item "m"
Print number of Mac line breaks.
.IP "\fBb\fR" 4
.IX Item "b"
Print the byte order mark.
.IP "\fBt\fR" 4
.IX Item "t"
Print if file is text or binary.
.IP "\fBc\fR" 4
.IX Item "c"
Print only the files that would be converted.
.Sp
With the \f(CW\*(C`c\*(C'\fR flag dos2unix will print only the files that contain \s-1DOS\s0 line breaks,
unix2dos will print only file names that have Unix line breaks.
.RE
.RS 4
.Sp
Examples:
.Sp
Show information for all *.txt files:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Show only the number of \s-1DOS\s0 line breaks and Unix line breaks:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Show only the byte order mark:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
List the files that have \s-1DOS\s0 line breaks:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
List the files that have Unix line breaks:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Keep the date stamp of output file same as input file.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Display program's license.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Add additional newline.
.Sp
\&\fBdos2unix\fR: Only \s-1DOS\s0 line breaks are changed to two Unix line breaks.
In Mac mode only Mac line breaks are changed to two Unix
line breaks.
.Sp
\&\fBunix2dos\fR: Only Unix line breaks are changed to two \s-1DOS\s0 line breaks.
In Mac mode Unix line breaks are changed to two Mac line breaks.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Write a Byte Order Mark (\s-1BOM\s0) in the output file. By default an \s-1UTF\-8 BOM\s0
is written.
.Sp
When the input file is \s-1UTF\-16,\s0 and the option \f(CW\*(C`\-u\*(C'\fR is used, an \s-1UTF\-16
BOM\s0 will be written.
.Sp
Never use this option when the output encoding is other than \s-1UTF\-8\s0 or \s-1UTF\-16.\s0
See also section \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1INFILE OUTFILE ...\s0\fR" 4
.IX Item "-n, --newfile INFILE OUTFILE ..."
New file mode. Convert file \s-1INFILE\s0 and write output to file \s-1OUTFILE.\s0
File names must be given in pairs and wildcard names should \fInot\fR be
used or you \fIwill\fR lose your files.
.Sp
The person who starts the conversion in new file (paired) mode will be the owner
of the converted file. The read/write permissions of the new file will be the
permissions of the original file minus the \fIumask\fR\|(1) of the person who runs the
conversion.
.IP "\fB\-o, \-\-oldfile \s-1FILE ...\s0\fR" 4
.IX Item "-o, --oldfile FILE ..."
Old file mode. Convert file \s-1FILE\s0 and overwrite output to it. The program
defaults to run in this mode. Wildcard names may be used.
.Sp
In old file (in-place) mode the converted file gets the same owner, group, and
read/write permissions as the original file. Also when the file is converted by
another user who has write permissions on the file (e.g. user root). The
conversion will be aborted when it is not possible to preserve the original
values. Change of owner could mean that the original owner is not able to read
the file any more. Change of group could be a security risk, the file could be
made readable for persons for whom it is not intended. Preservation of owner,
group, and read/write permissions is only supported on Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Quiet mode. Suppress all warnings and messages. The return value is zero.
Except when wrong command-line options are used.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Remove Byte Order Mark (\s-1BOM\s0). Do not write a \s-1BOM\s0 in the output file.
This is the default behavior when converting to Unix line breaks.
See also option \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Skip binary files (default).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Keep the original \s-1UTF\-16\s0 encoding of the input file. The output file will be
written in the same \s-1UTF\-16\s0 encoding, little or big endian, as the input file.
This prevents transformation to \s-1UTF\-8.\s0 An \s-1UTF\-16 BOM\s0 will be written
accordingly. This option can be disabled with the \f(CW\*(C`\-ascii\*(C'\fR option.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Assume that the input file format is \s-1UTF\-16LE.\s0
.Sp
When there is a Byte Order Mark in the input file the \s-1BOM\s0 has priority over
this option.
.Sp
When you made a wrong assumption (the input file was not in \s-1UTF\-16LE\s0 format) and
the conversion succeeded, you will get an \s-1UTF\-8\s0 output file with wrong text.
You can undo the wrong conversion with \fIiconv\fR\|(1) by converting the \s-1UTF\-8\s0 output
file back to \s-1UTF\-16LE.\s0 This will bring back the original file.
.Sp
The assumption of \s-1UTF\-16LE\s0 works as a \fIconversion mode\fR. By switching to the default
\&\fIascii\fR mode the \s-1UTF\-16LE\s0 assumption is turned off.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Assume that the input file format is \s-1UTF\-16BE.\s0
.Sp
This option works the same as option \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Display verbose messages. Extra information is displayed about Byte Order Marks
and the amount of converted line breaks.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Follow symbolic links and convert the targets.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Replace symbolic links with converted files
(original target files remain unchanged).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Keep symbolic links and targets unchanged (default).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Display version information and exit.
.SH "MAC MODE"
.IX Header "MAC MODE"
In normal mode line breaks are converted from \s-1DOS\s0 to Unix and vice versa.
Mac line breaks are not converted.
.PP
In Mac mode line breaks are converted from Mac to Unix and vice versa. \s-1DOS\s0
line breaks are not changed.
.PP
To run in Mac mode use the command-line option \f(CW\*(C`\-c mac\*(C'\fR or use the
commands \f(CW\*(C`mac2unix\*(C'\fR or \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSION MODES"
.IX Header "CONVERSION MODES"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In mode \f(CW\*(C`ascii\*(C'\fR only line breaks are converted. This is the default conversion
mode.
.Sp
Although the name of this mode is \s-1ASCII,\s0 which is a 7 bit standard, the
actual mode is 8 bit. Use always this mode when converting Unicode \s-1UTF\-8\s0
files.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
In this mode all 8 bit non-ASCII characters (with values from 128 to 255)
are converted to a 7 bit space.
.IP "\fBiso\fR" 4
.IX Item "iso"
Characters are converted between a \s-1DOS\s0 character set (code page) and \s-1ISO\s0
character set \s-1ISO\-8859\-1 \s0(Latin\-1) on Unix. \s-1DOS\s0 characters without \s-1ISO\-8859\-1\s0
equivalent, for which conversion is not possible, are converted to a dot. The
same counts for \s-1ISO\-8859\-1\s0 characters without \s-1DOS\s0 counterpart.
.Sp
When only option \f(CW\*(C`\-iso\*(C'\fR is used dos2unix will try to determine the active code
page. When this is not possible dos2unix will use default code page \s-1CP437,\s0
which is mainly used in the \s-1USA. \s0 To force a specific code page use options
\&\f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (Western European), \f(CW\*(C`\-860\*(C'\fR (Portuguese), \f(CW\*(C`\-863\*(C'\fR (French
Canadian), or \f(CW\*(C`\-865\*(C'\fR (Nordic). Windows code page \s-1CP1252 \s0(Western European) is
also supported with option \f(CW\*(C`\-1252\*(C'\fR. For other code pages use dos2unix in
combination with \fIiconv\fR\|(1). Iconv can convert between a long list of character
encodings.
.Sp
Never use \s-1ISO\s0 conversion on Unicode text files. It will corrupt \s-1UTF\-8\s0 encoded files.
.Sp
Some examples:
.Sp
Convert from \s-1DOS\s0 default code page to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from \s-1DOS CP850\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Windows \s-1CP1252\s0 to Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS\s0 default code page:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix Latin\-1 to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Convert from Unix \s-1UTF\-8 \s0(Unicode) to Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
See also <http://czyborra.com/charsets/codepages.html>
and <http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Encodings"
.IX Subsection "Encodings"
There exist different Unicode encodings. On Unix and Linux Unicode files are
typically encoded in \s-1UTF\-8\s0 encoding. On Windows Unicode text files can be
encoded in \s-1UTF\-8, UTF\-16,\s0 or \s-1UTF\-16\s0 big endian, but are mostly encoded in
\&\s-1UTF\-16\s0 format.
.SS "Conversion"
.IX Subsection "Conversion"
Unicode text files can have \s-1DOS,\s0 Unix or Mac line breaks, like regular text
files.
.PP
All versions of dos2unix and unix2dos can convert \s-1UTF\-8\s0 encoded files, because
\&\s-1UTF\-8\s0 was designed for backward compatibility with \s-1ASCII.\s0
.PP
Dos2unix and unix2dos with Unicode \s-1UTF\-16\s0 support, can read little and big
endian \s-1UTF\-16\s0 encoded text files. To see if dos2unix was built with \s-1UTF\-16\s0
support type \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
On Unix/Linux \s-1UTF\-16\s0 encoded files are converted to the locale character
encoding. Use the \fIlocale\fR\|(1) command to find out what the locale character
encoding is. When conversion is not possible a conversion error will occur and
the file will be skipped.
.PP
On Windows \s-1UTF\-16\s0 files are by default converted to \s-1UTF\-8. UTF\-8\s0 formatted
text files are well supported on both Windows and Unix/Linux.
.PP
\&\s-1UTF\-16\s0 and \s-1UTF\-8\s0 encoding are fully compatible, there will no text be lost in
the conversion. When an \s-1UTF\-16\s0 to \s-1UTF\-8\s0 conversion error occurs, for instance
when the \s-1UTF\-16\s0 input file contains an error, the file will be skipped.
.PP
When option \f(CW\*(C`\-u\*(C'\fR is used, the output file will be written in the same \s-1UTF\-16\s0
encoding as the input file. Option \f(CW\*(C`\-u\*(C'\fR prevents conversion to \s-1UTF\-8.\s0
.PP
Dos2unix and unix2dos have no option to convert \s-1UTF\-8\s0 files to \s-1UTF\-16.\s0
.PP
\&\s-1ISO\s0 and 7\-bit mode conversion do not work on \s-1UTF\-16\s0 files.
.SS "Byte Order Mark"
.IX Subsection "Byte Order Mark"
On Windows Unicode text files typically have a Byte Order Mark (\s-1BOM\s0), because
many Windows programs (including Notepad) add BOMs by default. See also
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
On Unix Unicode files typically don't have a \s-1BOM.\s0 It is assumed that text files
are encoded in the locale character encoding.
.PP
Dos2unix can only detect if a file is in \s-1UTF\-16\s0 format if the file has a \s-1BOM.\s0
When an \s-1UTF\-16\s0 file doesn't have a \s-1BOM,\s0 dos2unix will see the file as a binary
file.
.PP
Use option \f(CW\*(C`\-ul\*(C'\fR or \f(CW\*(C`\-ub\*(C'\fR to convert an \s-1UTF\-16\s0 file without \s-1BOM.\s0
.PP
Dos2unix writes by default no \s-1BOM\s0 in the output file. With option \f(CW\*(C`\-b\*(C'\fR
Dos2unix writes a \s-1BOM\s0 when the input file has a \s-1BOM.\s0
.PP
Unix2dos writes by default a \s-1BOM\s0 in the output file when the input file has a
\&\s-1BOM.\s0 Use option \f(CW\*(C`\-r\*(C'\fR to remove the \s-1BOM.\s0
.PP
Dos2unix and unix2dos write always a \s-1BOM\s0 when option \f(CW\*(C`\-m\*(C'\fR is used.
.SS "Unicode examples"
.IX Subsection "Unicode examples"
Convert from Windows \s-1UTF\-16 \s0(with \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Convert from Windows \s-1UTF\-16LE \s0(without \s-1BOM\s0) to Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-8\s0 with \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Convert from Unix \s-1UTF\-8\s0 to Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is a Chinese government standard. A mandatory subset of the \s-1GB18030\s0
standard is officially required for all software products sold in China. See
also <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is fully compatible with Unicode, and can be considered an unicode
transformation format. Like \s-1UTF\-8, GB18030\s0 is compatible with \s-1ASCII. GB18030\s0
is also compatible with Windows code page 936, also known as \s-1GBK.\s0
.PP
On Unix/Linux \s-1UTF\-16\s0 files are converted to \s-1GB18030\s0 when the locale encoding is
set to \s-1GB18030.\s0 Note that this will only work if the location is set to China.
E.g. in an English British locale setting \f(CW\*(C`en_GB.GB18030\*(C'\fR conversion of \s-1UTF\-16\s0
to \s-1GB18030\s0 will not work, but in a Chinese \f(CW\*(C`zh_CN.GB18030\*(C'\fR locale setting it
will work.
.PP
On Windows you need to use option \f(CW\*(C`\-gb\*(C'\fR to convert \s-1UTF\-16\s0 files to \s-1GB18030.\s0
.PP
\&\s-1GB18030\s0 encoded files can have a Byte Order Mark, like Unicode files.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Read input from 'stdin' and write output to 'stdout':
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Convert and replace a.txt. Convert and replace b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Convert and replace a.txt in ascii conversion mode,
convert and replace b.txt in 7bit conversion mode:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Convert a.txt from Mac to Unix format:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Convert a.txt from Unix to Mac format:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Convert and replace a.txt while keeping original date stamp:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Convert a.txt and write to e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Convert and replace a.txt, convert b.txt and write to e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Convert c.txt and write to e.txt, convert and replace a.txt,
convert and replace b.txt, convert d.txt and write to f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIVE CONVERSION"
.IX Header "RECURSIVE CONVERSION"
Use dos2unix in combination with the \fIfind\fR\|(1) and \fIxargs\fR\|(1) commands to
recursively convert text files in a directory tree structure. For instance to
convert all .txt files in the directory tree under the current directory type:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZATION"
.IX Header "LOCALIZATION"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
The primary language is selected with the environment variable \s-1LANG.\s0 The \s-1LANG\s0
variable consists out of several parts. The first part is in small letters the
language code. The second is optional and is the country code in capital
letters, preceded with an underscore. There is also an optional third part:
character encoding, preceded with a dot. A few examples for \s-1POSIX\s0 standard type
shells:
.Sp
.Vb 7
\& export LANG=nl Dutch
\& export LANG=nl_NL Dutch, The Netherlands
\& export LANG=nl_BE Dutch, Belgium
\& export LANG=es_ES Spanish, Spain
\& export LANG=es_MX Spanish, Mexico
\& export LANG=en_US.iso88591 English, USA, Latin\-1 encoding
\& export LANG=en_GB.UTF\-8 English, UK, UTF\-8 encoding
.Ve
.Sp
For a complete list of language and country codes see the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
On Unix systems you can use the command \fIlocale\fR\|(1) to get locale specific
information.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
With the \s-1LANGUAGE\s0 environment variable you can specify a priority list of
languages, separated by colons. Dos2unix gives preference to \s-1LANGUAGE\s0 over \s-1LANG.\s0
For instance, first Dutch and then German: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. You have to first
enable localization, by setting \s-1LANG \s0(or \s-1LC_ALL\s0) to a value other than
\&\*(L"C\*(R", before you can use a language priority list through the \s-1LANGUAGE\s0
variable. See also the gettext manual:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
If you select a language which is not available you will get the
standard English messages.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
With the environment variable \s-1DOS2UNIX_LOCALEDIR\s0 the \s-1LOCALEDIR\s0 set
during compilation can be overruled. \s-1LOCALEDIR\s0 is used to find the
language files. The \s-1GNU\s0 default value is \f(CW\*(C`/usr/local/share/locale\*(C'\fR.
Option \fB\-\-version\fR will display the \s-1LOCALEDIR\s0 that is used.
.Sp
Example (\s-1POSIX\s0 shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
On success, zero is returned. When a system error occurs the last system error will be
returned. For other errors 1 is returned.
.PP
The return value is always zero in quiet mode, except when wrong command-line options
are used.
.SH "STANDARDS"
.IX Header "STANDARDS"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTHORS"
.IX Header "AUTHORS"
Benjamin Lin \- <blin@socs.uts.edu.au>,
Bernd Johannes Wuebben (mac2unix mode) \- <wuebben@kde.org>,
Christian Wurll (add extra newline) \- <wurll@ira.uka.de>,
Erwin Waterlander \- <waterlan@xs4all.nl> (maintainer)
.PP
Project page: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge page: <http://sourceforge.net/projects/dos2unix/>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIfile\fR\|(1)
\&\fIfind\fR\|(1)
\&\fIiconv\fR\|(1)
\&\fIlocale\fR\|(1)
\&\fIxargs\fR\|(1)

View File

@@ -1,761 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAAM"
.IX Header "NAAM"
dos2unix \- omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix en
vice versa
.SH "OVERZICHT"
.IX Header "OVERZICHT"
.Vb 2
\& dos2unix [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
\& unix2dos [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
.Ve
.SH "BESCHRIJVING"
.IX Header "BESCHRIJVING"
Het Dos2unix pakket bevat de toepassingen \f(CW\*(C`dos2unix\*(C'\fR en \f(CW\*(C`unix2dos\*(C'\fR om
platte tekstbestanden in \s-1DOS\-\s0 of Mac-indeling naar Unix-indeling om te
zetten, en vice versa.
.PP
In DOS/Windows\-tekstbestanden bestaat een regeleinde uit een combinatie van
twee tekens: een 'Carriage Return' (\s-1CR\s0) gevolgd door een 'Line Feed' (\s-1LF\s0).
In Unix-tekstbestanden bestaat een regeleinde uit één enkel 'Newline'\-teken,
dat gelijk is aan een \s-1DOS \s0'Line Feed'-teken (\s-1LF\s0). In Mac-tekstbestanden,
van vóór Mac \s-1OS X,\s0 bestaan regeleindes uit één enkel 'Carriage
Return'-teken. Mac \s-1OS X\s0 is op Unix gebaseerd en heeft dezelfde regeleindes
als Unix.
.PP
Naast regeleindes kan Dos2unix ook de codering van bestanden converteren.
Enkele DOS-codetabellen kunnen omgezet worden naar Unix Latin\-1. En Windows
Unicode-bestanden (\s-1UTF\-16\s0) kunnen geconverteerd worden naar Unix
Unicode-bestanden (\s-1UTF\-8\s0).
.PP
Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting
geforceerd wordt.
.PP
Niet-reguliere bestanden, zoals mappen en \s-1FIFO\s0's, worden automatisch
overgeslagen.
.PP
Symbolische koppelingen en hun doelen blijven standaard onaangeroerd.
Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer kan
naar het doel van de symbolische koppeling worden geschreven. Op Windows
wordt het schrijven naar het doel van een symbolische koppeling niet
ondersteund.
.PP
Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is één
belangrijk verschil: deze versie van dos2unix voert standaard een
vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke
SunOS/Solaris\-versie alleen de gepaarde conversie (nieuw-bestand-modus)
kent. Zie ook de opties \f(CW\*(C`\-o\*(C'\fR en \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIES"
.IX Header "OPTIES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Alle volgende opties als bestandsnamen behandelen. Gebruik deze optie als u
een bestand wilt converteren waarvan de naam met een streepje begint.
Bijvoorbeeld, om een bestand genaamd \*(L"\-foo\*(R" om te zetten, gebruikt u de
volgende opdracht:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Of in nieuw-bestand-modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo uit.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Alleen regeleindes converteren. Dit is de standaardconversiemodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversie tussen de tekensets \s-1DOS\s0 en \s-1ISO\-8859\-1. \s0 Zie ook de sectie
\&\s-1CONVERSIEMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Windows-codetabel 1252 (West-Europees) gebruiken.
.IP "\fB\-437\fR" 4
.IX Item "-437"
DOS-codetabel 437 (\s-1VS\s0) gebruiken. Dit is de standaard codetabel die
gebruikt wordt bij ISO-conversie.
.IP "\fB\-850\fR" 4
.IX Item "-850"
DOS-codetabel 850 (West-Europees) gebruiken.
.IP "\fB\-860\fR" 4
.IX Item "-860"
DOS-codetabel 860 (Portugees) gebruiken.
.IP "\fB\-863\fR" 4
.IX Item "-863"
DOS-codetabel 863 (Canadees Frans) gebruiken.
.IP "\fB\-865\fR" 4
.IX Item "-865"
DOS-codetabel 865 (Scandinavisch) gebruiken.
.IP "\fB\-7\fR" 4
.IX Item "-7"
Lettertekens met het achtste bit gezet converteren naar spaties.
.IP "\fB\-b\fR, \fB\-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Een Byte-Order-Mark (\s-1BOM\s0) behouden. Als het invoerbestand een \s-1BOM\s0 bevat,
dan wordt ook een \s-1BOM\s0 naar het uitvoerbestand geschreven. Dit is het
standaardgedrag bij conversie naar \s-1DOS. \s0 Zie ook optie \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c\fR, \fB\-\-convmode \s-1CONVERSIEMODUS\s0\fR" 4
.IX Item "-c, --convmode CONVERSIEMODUS"
De te gebruiken conversiemodus. \s-1CONVERSIEMODUS\s0 kan zijn: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, of \fImac\fR, waarbij ascii de standaardinstelling is.
.IP "\fB\-f\fR, \fB\-\-force\fR" 4
.IX Item "-f, --force"
Conversie van binaire bestanden afdwingen.
.IP "\fB\-gb\fR, \fB\-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd,
ongeacht de ingestelde taalregio. Gebruik deze optie om UTF\-16\-bestanden
naar \s-1GB18030\s0 te converteren. Deze optie is alleen beschikbaar op Windows.
Zie ook de sectie \fB\s-1GB18030\s0\fR.
.IP "\fB\-h\fR, \fB\-\-help\fR" 4
.IX Item "-h, --help"
Een hulptekst tonen.
.IP "\fB\-i\fR[\fB\s-1VLAGGEN\s0\fR], \fB\-\-info\fR[\fB=VLAGGEN\fR] \fB\s-1BESTAND\s0\fR..." 4
.IX Item "-i[VLAGGEN], --info[=VLAGGEN] BESTAND..."
Bestandsinformatie tonen. Er wordt niets geconverteerd.
.Sp
De volgende informatie wordt weergegeven, in deze volgorde: het aantal
DOS-regeleindes, het aantal Unix-regeleindes, het aantal Mac-regeleindes, de
Byte-Order-Mark, of het een tekst\- of binair bestand is, en de bestandsnaam.
.Sp
Voorbeelduitvoer:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Bij de optie kunnen één of meer vlaggen meegegeven worden om de uitvoer te
beperken.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Het aantal DOS-regeleindes tonen.
.IP "\fBu\fR" 4
.IX Item "u"
Het aantal Unix-regeleindes tonen.
.IP "\fBm\fR" 4
.IX Item "m"
Het aantal Mac-regeleindes tonen.
.IP "\fBb\fR" 4
.IX Item "b"
De Byte-Order-Mark tonen.
.IP "\fBt\fR" 4
.IX Item "t"
Tonen of het bestand tekst is of binair.
.IP "\fBc\fR" 4
.IX Item "c"
Alleen de namen tonen van de bestanden die geconverteerd zouden worden.
.Sp
Met de vlag \f(CW\*(C`c\*(C'\fR toont dos2unix alleen de bestanden die DOS-regeleindes
bevatten, en unix2dos alleen de bestanden die Unix-regeleindes bevatten.
.RE
.RS 4
.Sp
Voorbeelden:
.Sp
Informatie weergeven voor alle bestanden met de extensie 'txt':
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Alleen de Byte-Order-Mark tonen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
De bestanden opsommen die DOS-regeleindes bevatten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
De bestanden opsommen die Unix-regeleindes bevatten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k\fR, \fB\-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Het tijdsstempel van het invoerbestand behouden voor het uitvoerbestand.
.IP "\fB\-L\fR, \fB\-\-license\fR" 4
.IX Item "-L, --license"
De softwarelicentie tonen.
.IP "\fB\-l\fR, \fB\-\-newline\fR" 4
.IX Item "-l, --newline"
Een extra regeleinde toevoegen.
.Sp
\&\fBdos2unix\fR: Alleen DOS-regeleindes worden omgezet naar twee
Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet naar
twee Unix-regeleindes.
.Sp
\&\fBunix2dos\fR: Alleen Unix-regeleindes worden omgezet naar twee
DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar twee
Mac-regeleindes.
.IP "\fB\-m\fR, \fB\-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Een Byte-Order-Mark (\s-1BOM\s0) naar het uitvoerbestand schrijven. Standaard
wordt een \s-1UTF\-8\-BOM\s0 geschreven.
.Sp
Als het invoerbestand in \s-1UTF\-16\s0 is, en de optie \f(CW\*(C`\-u\*(C'\fR is gegeven, dan wordt
een \s-1UTF\-16\-BOM\s0 geschreven.
.Sp
Gebruik deze optie nooit als de codering van het uitvoerbestand niet \s-1UTF\-8\s0
of \s-1UTF\-16\s0 is. Zie ook de sectie \s-1UNICODE.\s0
.IP "\fB\-n\fR, \fB\-\-newfile \s-1INVOERBESTAND UITVOERBESTAND\s0\fR ..." 4
.IX Item "-n, --newfile INVOERBESTAND UITVOERBESTAND ..."
Nieuw-bestand-modus. Het bestand \s-1INVOERBESTAND\s0 converteren en naar bestand
\&\s-1UITVOERBESTAND\s0 schrijven. Bestandsnamen moeten opgegeven worden in paren.
Jokertekens moeten \fIniet\fRgebruikt worden, anders \fIverlies\fR je de
bestanden.
.Sp
De gebruiker die de conversie start in nieuw-bestand (gepaarde) modus wordt
de eigenaar van het geconverteerde bestand. De lees/schrijf\-toegangsrechten
van het nieuwe bestand worden de toegangsrechten van het originele bestand
minus de \fIumask\fR\|(1) van de gebruiker die de conversie draait.
.IP "\fB\-o\fR, \fB\-\-oldfile \s-1BESTAND\s0\fR ..." 4
.IX Item "-o, --oldfile BESTAND ..."
Oud-bestand-modus. Het bestand \s-1BESTAND\s0 converteren en overschrijven. Dit
is de standaard modus. Jokertekens kunnen gebruikt worden.
.Sp
In oud-bestand (vervangende) modus krijgt het geconverteerde bestand
dezelfde eigenaar, groep en lees/schrijf\-rechten als het originele bestand.
Ook wanneer het bestand wordt omgezet door een andere gebruiker die
schrijfrechten heeft op het bestand (b.v. gebruiker root). De omzetting
wordt afgebroken wanneer het niet mogelijk is de originele waardes te
behouden. Verandering van eigenaar kan betekenen dat de originele eigenaar
het bestand niet meer kan lezen. Verandering van groep zou een
veiligheidsrisico kunnen zijn, het bestand zou leesbaar kunnen worden voor
personen voor wie het niet bestemd is. Behoud van eigenaar, groep en
lees/schrijf\-rechten wordt alleen ondersteund op Unix.
.IP "\fB\-q\fR, \fB\-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde is nul,
behalve wanneer verkeerde opties worden gegeven.
.IP "\fB\-r\fR, \fB\-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Een Byte-Order-Mark (\s-1BOM\s0) verwijderen. Er wordt geen \s-1BOM\s0 naar het
uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar
Unix. Zie ook optie \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s\fR, \fB\-\-safe\fR" 4
.IX Item "-s, --safe"
Binaire bestanden overslaan (standaard).
.IP "\fB\-u\fR, \fB\-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
De originele UTF\-16\-codering van het invoerbestand behouden. Het
uitvoerbestand wordt in dezelfde UTF\-16\-codering (little endian of big
endian) geschreven als het invoerbestand. Dit voorkomt conversie naar
\&\s-1UTF\-8. \s0 Er wordt ook een corresponderende \s-1UTF\-16\-BOM\s0 geschreven. Deze optie
kan uitgeschakeld worden met de optie \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul\fR, \fB\-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16LE\s0 is.
.Sp
Wanneer het invoerbestand een Byte-Order-Mark (\s-1BOM\s0) bevat, dan gaat deze \s-1BOM\s0
vóór deze optie.
.Sp
Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen
\&\s-1UTF\-16LE\s0) en de conversie verliep met succes, dan krijgt u een UTF\-8\-bestand
met verkeerde tekst. De verkeerde conversie kan ongedaan worden gemaakt
door met \fIiconv\fR\|(1) het UTF\-8\-uitvoerbestand terug om te zetten naar
\&\s-1UTF\-16LE. \s0 Dit zal het originele bestand terug brengen.
.Sp
De aanname van \s-1UTF\-16LE\s0 werkt als een \fIconversiemodus\fR. Door de
standaardmodus \fIascii\fR in te schakelen wordt de UTF\-16LE\-veronderstelling
uitgeschakeld.
.IP "\fB\-ub\fR, \fB\-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16BE\s0 is.
.Sp
Deze optie werkt hetzelfde als optie \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
.IX Item "-v, --verbose"
Extra meldingen weergeven. Er wordt extra informatie getoond over
Byte-Order-Marks en het aantal geconverteerde regeleindes.
.IP "\fB\-F\fR, \fB\-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Symbolische koppelingen volgen en de doelen converteren.
.IP "\fB\-R\fR, \fB\-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Symbolische koppelingen vervangen door geconverteerde bestanden (de
originele doelbestanden blijven ongewijzigd).
.IP "\fB\-S\fR, \fB\-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Symbolische koppelingen en doelen ongewijzigd laten (standaard).
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
.IX Item "-V, --version"
Versie-informatie tonen.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa.
Mac-regeleindes worden niet omgezet.
.PP
In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa.
DOS-regeleindes blijven ongewijzigd.
.PP
Om in Mac-modus te draaien kunt u de opdrachtregeloptie \f(CW\*(C`\-c mac\*(C'\fR gebruiken,
of de opdrachten \f(CW\*(C`mac2unix\*(C'\fR of \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSIEMODI"
.IX Header "CONVERSIEMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In modus \f(CW\*(C`ascii\*(C'\fR worden alleen regeleindes omgezet. Dit is de
standaardmodus.
.Sp
Hoewel de naam van deze modus \s-1ASCII\s0 is, wat een 7\-bits standaard is, is de
werkelijke modus 8\-bits. Gebruik altijd deze modus wanneer u Unicode
UTF\-8\-bestanden omzet.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Alle 8\-bits niet-ASCII lettertekens (met waardes van 128 t/m 255) worden
omgezet naar een 7\-bits spatie.
.IP "\fBiso\fR" 4
.IX Item "iso"
Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de ISO-tekenset
\&\s-1ISO\-8859\-1 \s0(Latin\-1) op Unix. DOS-tekens zonder een ISO\-8859\-1\-equivalent,
waarvoor dus geen omzetting mogelijk is, worden omgezet in een punt.
Hetzelfde geldt voor ISO\-8859\-1\-tekens zonder DOS-tegenhanger.
.Sp
Wanneer alleen optie \f(CW\*(C`\-iso\*(C'\fR gebruikt wordt, zal dos2unix proberen de
actieve codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel
\&\s-1CP437\s0 gebruikt, die vooral in de \s-1VS\s0 gebruikt wordt. Om een bepaalde
codetabel te forceren, kunt u de opties \f(CW\*(C`\-850\*(C'\fR (West-Europees), \f(CW\*(C`\-860\*(C'\fR
(Portugees), \f(CW\*(C`\-863\*(C'\fR (Canadees Frans) of \f(CW\*(C`\-865\*(C'\fR (Scandinavisch) gebruiken.
Windows-codetabel \s-1CP1252 \s0(West-Europees) wordt ook ondersteund met optie
\&\f(CW\*(C`\-1252\*(C'\fR. Gebruik voor andere codetabellen dos2unix in combinatie met
\&\fIiconv\fR\|(1). Iconv kan omzetten tussen een lange lijst tekensetcoderingen.
.Sp
Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal
UTF\-8\-gecodeerde bestanden beschadigen.
.Sp
Enkele voorbeelden:
.Sp
Omzetten van de standaard DOS-codetabel naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van \s-1DOS CP850\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar de standaard DOS-codetabel:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix \s-1UTF\-8 \s0(Unicode) naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > uit.txt
.Ve
.Sp
Zie ook <http://czyborra.com/charsets/codepages.html> en
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Coderingen"
.IX Subsection "Coderingen"
Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn
Unicode-bestanden typisch gecodeerd in \s-1UTF\-8. \s0 Op Windows kunnen
Unicode-tekstbestanden gecodeerd zijn in \s-1UTF\-8, UTF\-16\s0 of \s-1UTF\-16\s0 big endian,
maar ze zijn meestal gecodeerd in \s-1UTF\-16.\s0
.SS "Conversie"
.IX Subsection "Conversie"
Unicode-tekstbestanden kunnen \s-1DOS\-,\s0 Unix\- of Mac-regeleindes hebben, net als
reguliere tekstbestanden.
.PP
Alle versies van dos2unix en unix2dos kunnen UTF\-8\-gecodeerde bestanden
omzetten, want \s-1UTF\-8\s0 is ontworpen op compatibiliteit met \s-1ASCII.\s0
.PP
Dos2unix en unix2dos met Unicode UTF\-16\-ondersteuning kunnen little en big
endian UTF\-16\-gecodeerde tekstbestanden lezen. Om er achter te komen of
dos2unix gebouwd is met \s-1UTF\-16\-\s0 ondersteuning, typt u \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Op Unix/Linux worden UTF\-16\-bestanden geconverteerd naar de codering van de
ingestelde taalregio. Gebruik de opdracht \fBlocale\fR(1) om te zien wat de
ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er een
fout op en wordt het bestand overgeslagen.
.PP
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd.
UTF\-8\-tekstbestanden worden alom goed ondersteund, zowel op Windows als
Unix/Linux.
.PP
De \s-1UTF\-16\-\s0 en UTF\-8\-coderingen zijn volledig compatibel, er gaat bij het
converteren niets verloren. Als er tijdens de conversie van \s-1UTF\-16\s0 naar
\&\s-1UTF\-8\s0 een fout optreedt, bijvoorbeeld omdat het UTF\-16\-invoerbestand een
fout bevat, dan wordt het bestand overgeslagen.
.PP
Wanneer \f(CW\*(C`\-u\*(C'\fR gebruikt wordt, wordt het uitvoerbestand in dezelfde
UTF\-16\-codering geschreven als het invoerbestand. Optie \f(CW\*(C`\-u\*(C'\fR voorkomt
conversie naar \s-1UTF\-8.\s0
.PP
Dos2unix en unix2dos hebben geen optie om van \s-1UTF\-8\s0 naar \s-1UTF\-16\s0 te
converteren.
.PP
\&\s-1ISO\-\s0 en 7\-bits\-conversie werken niet op UTF\-16\-bestanden.
.SS "Byte-Order-Mark"
.IX Subsection "Byte-Order-Mark"
Op Windows bevatten Unicode-tekstbestanden gewoonlijk een Byte-Order-Mark
(\s-1BOM\s0), omdat veel Windows-programma's (inclusief Kladblok) standaard een \s-1BOM\s0
toevoegen. Zie ook <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
Op Unix hebben Unicode-tekstbestanden meestal geen \s-1BOM. \s0 Er wordt aangenomen
dat de codering van tekstbestanden gelijk is aan de tekencodering van de
ingestelde taalregio.
.PP
Dos2unix kan alleen detecteren of een bestand in UTF\-16\-codering is als het
bestand een \s-1BOM\s0 bevat. Wanneer een UTF\-16\-bestand geen \s-1BOM\s0 heeft, ziet
dos2unix het bestand als een binair bestand.
.PP
Gebruik optie \f(CW\*(C`\-ul\*(C'\fR of \f(CW\*(C`\-ub\*(C'\fR om een UTF\-16\-bestand zonder \s-1BOM\s0 om te
zetten.
.PP
Dos2unix schrijft standaard geen \s-1BOM\s0 in het uitvoerbestand. Met optie \f(CW\*(C`\-b\*(C'\fR
schrijft dos2unix een \s-1BOM\s0 wanneer het invoerbestand een \s-1BOM\s0 bevat.
.PP
Unix2dos schrijft standaard een \s-1BOM\s0 in het uitvoerbestand wanneer het
invoerbestand een \s-1BOM\s0 bevat. Gebruik optie \f(CW\*(C`\-r\*(C'\fR om de \s-1BOM\s0 te verwijderen.
.PP
Dos2unix en unix2dos schrijven altijd een \s-1BOM\s0 wanneer optie \f(CW\*(C`\-m\*(C'\fR gebruikt
wordt.
.SS "Unicode-voorbeelden"
.IX Subsection "Unicode-voorbeelden"
Omzetten van Windows \s-1UTF\-16 \s0(met \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt uit.txt
.Ve
.PP
Omzetten van Windows \s-1UTF\-16LE \s0(zonder \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-8\s0 met \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > uit.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is een standaard van de Chinese overheid. Een subset van de
GB18030\-standaard is officieel verplicht voor alle softwareproducten die in
China verkocht worden. Zie ook <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is volledig compatibel met Unicode, en kan als een
Unicodetransformatie beschouwd worden. Net als \s-1UTF\-8\s0 is \s-1GB18030\s0 compatibel
met \s-1ASCII. GB18030\s0 is ook compatibel met Windows-codetabel 936 (ook wel \s-1GBK\s0
genoemd).
.PP
Op Unix/Linux worden UTF\-16\-bestanden alleen naar \s-1GB18030\s0 geconverteerd
wanneer de taalregio op China ingesteld is en de codering op \s-1GB18030.\s0
Bijvoorbeeld, met de Britse taalregio-instelling \f(CW\*(C`en_GB.GB18030\*(C'\fR zal
conversie van \s-1UTF\-16\s0 naar \s-1GB18030\s0 niet werken, maar met de Chinese
instelling \f(CW\*(C`zh_CN.GB18030\*(C'\fR wel.
.PP
Op Windows dient u de optie \f(CW\*(C`\-gb\*(C'\fR te gebruiken om UTF\-16\-bestanden naar
\&\s-1GB18030\s0 te converteren.
.PP
GB18030\-bestanden kunnen een Byte-Order-Mark bevatten, net als
Unicode-bestanden.
.SH "VOORBEELDEN"
.IX Header "VOORBEELDEN"
Invoer lezen van standaardinvoer en uitvoer schrijven naar standaarduitvoer:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en
vervangen van b.txt in 7\-bits conversiemodus:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Omzetten van a.txt van Mac\- naar Unix-indeling:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Omzetten van a.txt van Unix\- naar Mac-indeling:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Omzetten van a.txt en resultaat naar e.txt schrijven:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt
gelijk aan die van a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt schrijven:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van a.txt;
omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt schrijven.
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIEVE CONVERSIE"
.IX Header "RECURSIEVE CONVERSIE"
Gebruik dos2unix in combinatie met de opdrachten \fBfind\fR(1) en \fBxargs\fR(1)
om tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om
alle .txt\-bestanden in de mappenboom onder de huidige map te converteren,
typt u:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISATIE"
.IX Header "LOKALISATIE"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
De primaire taal wordt geselecteerd via de omgevingsvariabele \s-1LANG. \s0 De
variabele \s-1LANG\s0 bestaat uit verschillende onderdelen. Het eerste deel is in
kleine letters de taalcode. Het tweede deel is optioneel en is de landcode
in hoofdletters, voorafgegaan door een liggend streepje. Er is ook een
optioneel derde deel: de tekencodering, voorafgegaan door een punt. Enkele
voorbeelden voor een POSIX-shell:
.Sp
.Vb 7
\& export LANG=nl Nederlands
\& export LANG=nl_NL Nederlands, Nederland
\& export LANG=nl_BE Nederlands, België
\& export LANG=es_ES Spaans, Spanje
\& export LANG=es_MX Spaans, Mexico
\& export LANG=en_US.iso88591 Engels, VS, Latin\-1\-codering
\& export LANG=en_GB.UTF\-8 Engels, GB, UTF\-8\-codering
.Ve
.Sp
Voor een complete lijst van taal\- en landcodes zie de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Op Unix-systemen kunt u de opdracht \fBlocale\fR(1) gebruiken om specifieke
taalregio-informatie te verkrijgen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Met de omgevingsvariabele \s-1LANGUAGE\s0 kunt u een prioriteitenlijst specificeren
van talen, gescheiden door dubbele punten. Dos2unix geeft voorrang aan
\&\s-1LANGUAGE\s0 boven \s-1LANG. \s0 Bijvoorbeeld, eerst Nederlands en dan Duits:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. U moet eerst lokalisatie in werking stellen, door het
instellen van \s-1LANG \s0(of \s-1LC_ALL\s0) op een waarde ongelijk aan \*(L"C\*(R", voordat u een
talen-prioriteitenlijst kunt gebruiken via de variabele \s-1LANGUAGE. \s0 Zie ook
de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Als u een taal kiest die niet beschikbaar is, worden de standaard Engelse
berichten gebruikt.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Met de omgevingsvariabele \s-1DOS2UNIX_LOCALEDIR\s0 kan de \s-1LOCALEDIR\s0 die ingesteld
werd tijdens compilatie worden overstemd. \s-1LOCALEDIR\s0 wordt gebruikt om de
taalbestanden te vinden. De \s-1GNU\s0 standaardwaarde is
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. De optie \fB\-\-version\fR laat de gebruikte
\&\s-1LOCALEDIR\s0 zien.
.Sp
Voorbeeld (POSIX-shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "AFSLUITWAARDE"
.IX Header "AFSLUITWAARDE"
Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt wordt
het laatste systeemfoutnummer teruggegeven. Bij andere fouten wordt 1
teruggegeven.
.PP
De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve wanneer
verkeerde opties worden gegeven.
.SH "STANDAARDEN"
.IX Header "STANDAARDEN"
<http://nl.wikipedia.org/wiki/Tekstbestand>
.PP
<http://nl.wikipedia.org/wiki/Carriage_Return>
.PP
<http://nl.wikipedia.org/wiki/Linefeed>
.PP
<http://nl.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(mac2unix\-modus) \- <wuebben@kde.org>, Christian Wurll (toevoegen van extra
regeleindes) \- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl>
(beheerder)
.PP
Projectpagina: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-pagina: <http://sourceforge.net/projects/dos2unix/>
.SH "ZIE OOK"
.IX Header "ZIE OOK"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,761 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAAM"
.IX Header "NAAM"
dos2unix \- omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix en
vice versa
.SH "OVERZICHT"
.IX Header "OVERZICHT"
.Vb 2
\& dos2unix [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
\& unix2dos [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
.Ve
.SH "BESCHRIJVING"
.IX Header "BESCHRIJVING"
Het Dos2unix pakket bevat de toepassingen \f(CW\*(C`dos2unix\*(C'\fR en \f(CW\*(C`unix2dos\*(C'\fR om
platte tekstbestanden in \s-1DOS\-\s0 of Mac-indeling naar Unix-indeling om te
zetten, en vice versa.
.PP
In DOS/Windows\-tekstbestanden bestaat een regeleinde uit een combinatie van
twee tekens: een 'Carriage Return' (\s-1CR\s0) gevolgd door een 'Line Feed' (\s-1LF\s0).
In Unix-tekstbestanden bestaat een regeleinde uit één enkel 'Newline'\-teken,
dat gelijk is aan een \s-1DOS \s0'Line Feed'-teken (\s-1LF\s0). In Mac-tekstbestanden,
van vóór Mac \s-1OS X,\s0 bestaan regeleindes uit één enkel 'Carriage
Return'-teken. Mac \s-1OS X\s0 is op Unix gebaseerd en heeft dezelfde regeleindes
als Unix.
.PP
Naast regeleindes kan Dos2unix ook de codering van bestanden converteren.
Enkele DOS-codetabellen kunnen omgezet worden naar Unix Latin\-1. En Windows
Unicode-bestanden (\s-1UTF\-16\s0) kunnen geconverteerd worden naar Unix
Unicode-bestanden (\s-1UTF\-8\s0).
.PP
Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting
geforceerd wordt.
.PP
Niet-reguliere bestanden, zoals mappen en \s-1FIFO\s0's, worden automatisch
overgeslagen.
.PP
Symbolische koppelingen en hun doelen blijven standaard onaangeroerd.
Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer kan
naar het doel van de symbolische koppeling worden geschreven. Op Windows
wordt het schrijven naar het doel van een symbolische koppeling niet
ondersteund.
.PP
Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is één
belangrijk verschil: deze versie van dos2unix voert standaard een
vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke
SunOS/Solaris\-versie alleen de gepaarde conversie (nieuw-bestand-modus)
kent. Zie ook de opties \f(CW\*(C`\-o\*(C'\fR en \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIES"
.IX Header "OPTIES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Alle volgende opties als bestandsnamen behandelen. Gebruik deze optie als u
een bestand wilt converteren waarvan de naam met een streepje begint.
Bijvoorbeeld, om een bestand genaamd \*(L"\-foo\*(R" om te zetten, gebruikt u de
volgende opdracht:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Of in nieuw-bestand-modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo uit.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Alleen regeleindes converteren. Dit is de standaardconversiemodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversie tussen de tekensets \s-1DOS\s0 en \s-1ISO\-8859\-1. \s0 Zie ook de sectie
\&\s-1CONVERSIEMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Windows-codetabel 1252 (West-Europees) gebruiken.
.IP "\fB\-437\fR" 4
.IX Item "-437"
DOS-codetabel 437 (\s-1VS\s0) gebruiken. Dit is de standaard codetabel die
gebruikt wordt bij ISO-conversie.
.IP "\fB\-850\fR" 4
.IX Item "-850"
DOS-codetabel 850 (West-Europees) gebruiken.
.IP "\fB\-860\fR" 4
.IX Item "-860"
DOS-codetabel 860 (Portugees) gebruiken.
.IP "\fB\-863\fR" 4
.IX Item "-863"
DOS-codetabel 863 (Canadees Frans) gebruiken.
.IP "\fB\-865\fR" 4
.IX Item "-865"
DOS-codetabel 865 (Scandinavisch) gebruiken.
.IP "\fB\-7\fR" 4
.IX Item "-7"
Lettertekens met het achtste bit gezet converteren naar spaties.
.IP "\fB\-b\fR, \fB\-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Een Byte-Order-Mark (\s-1BOM\s0) behouden. Als het invoerbestand een \s-1BOM\s0 bevat,
dan wordt ook een \s-1BOM\s0 naar het uitvoerbestand geschreven. Dit is het
standaardgedrag bij conversie naar \s-1DOS. \s0 Zie ook optie \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c\fR, \fB\-\-convmode \s-1CONVERSIEMODUS\s0\fR" 4
.IX Item "-c, --convmode CONVERSIEMODUS"
De te gebruiken conversiemodus. \s-1CONVERSIEMODUS\s0 kan zijn: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, of \fImac\fR, waarbij ascii de standaardinstelling is.
.IP "\fB\-f\fR, \fB\-\-force\fR" 4
.IX Item "-f, --force"
Conversie van binaire bestanden afdwingen.
.IP "\fB\-gb\fR, \fB\-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd,
ongeacht de ingestelde taalregio. Gebruik deze optie om UTF\-16\-bestanden
naar \s-1GB18030\s0 te converteren. Deze optie is alleen beschikbaar op Windows.
Zie ook de sectie \fB\s-1GB18030\s0\fR.
.IP "\fB\-h\fR, \fB\-\-help\fR" 4
.IX Item "-h, --help"
Een hulptekst tonen.
.IP "\fB\-i\fR[\fB\s-1VLAGGEN\s0\fR], \fB\-\-info\fR[\fB=VLAGGEN\fR] \fB\s-1BESTAND\s0\fR..." 4
.IX Item "-i[VLAGGEN], --info[=VLAGGEN] BESTAND..."
Bestandsinformatie tonen. Er wordt niets geconverteerd.
.Sp
De volgende informatie wordt weergegeven, in deze volgorde: het aantal
DOS-regeleindes, het aantal Unix-regeleindes, het aantal Mac-regeleindes, de
Byte-Order-Mark, of het een tekst\- of binair bestand is, en de bestandsnaam.
.Sp
Voorbeelduitvoer:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Bij de optie kunnen één of meer vlaggen meegegeven worden om de uitvoer te
beperken.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Het aantal DOS-regeleindes tonen.
.IP "\fBu\fR" 4
.IX Item "u"
Het aantal Unix-regeleindes tonen.
.IP "\fBm\fR" 4
.IX Item "m"
Het aantal Mac-regeleindes tonen.
.IP "\fBb\fR" 4
.IX Item "b"
De Byte-Order-Mark tonen.
.IP "\fBt\fR" 4
.IX Item "t"
Tonen of het bestand tekst is of binair.
.IP "\fBc\fR" 4
.IX Item "c"
Alleen de namen tonen van de bestanden die geconverteerd zouden worden.
.Sp
Met de vlag \f(CW\*(C`c\*(C'\fR toont dos2unix alleen de bestanden die DOS-regeleindes
bevatten, en unix2dos alleen de bestanden die Unix-regeleindes bevatten.
.RE
.RS 4
.Sp
Voorbeelden:
.Sp
Informatie weergeven voor alle bestanden met de extensie 'txt':
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Alleen de Byte-Order-Mark tonen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
De bestanden opsommen die DOS-regeleindes bevatten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
De bestanden opsommen die Unix-regeleindes bevatten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k\fR, \fB\-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Het tijdsstempel van het invoerbestand behouden voor het uitvoerbestand.
.IP "\fB\-L\fR, \fB\-\-license\fR" 4
.IX Item "-L, --license"
De softwarelicentie tonen.
.IP "\fB\-l\fR, \fB\-\-newline\fR" 4
.IX Item "-l, --newline"
Een extra regeleinde toevoegen.
.Sp
\&\fBdos2unix\fR: Alleen DOS-regeleindes worden omgezet naar twee
Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet naar
twee Unix-regeleindes.
.Sp
\&\fBunix2dos\fR: Alleen Unix-regeleindes worden omgezet naar twee
DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar twee
Mac-regeleindes.
.IP "\fB\-m\fR, \fB\-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Een Byte-Order-Mark (\s-1BOM\s0) naar het uitvoerbestand schrijven. Standaard
wordt een \s-1UTF\-8\-BOM\s0 geschreven.
.Sp
Als het invoerbestand in \s-1UTF\-16\s0 is, en de optie \f(CW\*(C`\-u\*(C'\fR is gegeven, dan wordt
een \s-1UTF\-16\-BOM\s0 geschreven.
.Sp
Gebruik deze optie nooit als de codering van het uitvoerbestand niet \s-1UTF\-8\s0
of \s-1UTF\-16\s0 is. Zie ook de sectie \s-1UNICODE.\s0
.IP "\fB\-n\fR, \fB\-\-newfile \s-1INVOERBESTAND UITVOERBESTAND\s0\fR ..." 4
.IX Item "-n, --newfile INVOERBESTAND UITVOERBESTAND ..."
Nieuw-bestand-modus. Het bestand \s-1INVOERBESTAND\s0 converteren en naar bestand
\&\s-1UITVOERBESTAND\s0 schrijven. Bestandsnamen moeten opgegeven worden in paren.
Jokertekens moeten \fIniet\fRgebruikt worden, anders \fIverlies\fR je de
bestanden.
.Sp
De gebruiker die de conversie start in nieuw-bestand (gepaarde) modus wordt
de eigenaar van het geconverteerde bestand. De lees/schrijf\-toegangsrechten
van het nieuwe bestand worden de toegangsrechten van het originele bestand
minus de \fIumask\fR\|(1) van de gebruiker die de conversie draait.
.IP "\fB\-o\fR, \fB\-\-oldfile \s-1BESTAND\s0\fR ..." 4
.IX Item "-o, --oldfile BESTAND ..."
Oud-bestand-modus. Het bestand \s-1BESTAND\s0 converteren en overschrijven. Dit
is de standaard modus. Jokertekens kunnen gebruikt worden.
.Sp
In oud-bestand (vervangende) modus krijgt het geconverteerde bestand
dezelfde eigenaar, groep en lees/schrijf\-rechten als het originele bestand.
Ook wanneer het bestand wordt omgezet door een andere gebruiker die
schrijfrechten heeft op het bestand (b.v. gebruiker root). De omzetting
wordt afgebroken wanneer het niet mogelijk is de originele waardes te
behouden. Verandering van eigenaar kan betekenen dat de originele eigenaar
het bestand niet meer kan lezen. Verandering van groep zou een
veiligheidsrisico kunnen zijn, het bestand zou leesbaar kunnen worden voor
personen voor wie het niet bestemd is. Behoud van eigenaar, groep en
lees/schrijf\-rechten wordt alleen ondersteund op Unix.
.IP "\fB\-q\fR, \fB\-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde is nul,
behalve wanneer verkeerde opties worden gegeven.
.IP "\fB\-r\fR, \fB\-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Een Byte-Order-Mark (\s-1BOM\s0) verwijderen. Er wordt geen \s-1BOM\s0 naar het
uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar
Unix. Zie ook optie \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s\fR, \fB\-\-safe\fR" 4
.IX Item "-s, --safe"
Binaire bestanden overslaan (standaard).
.IP "\fB\-u\fR, \fB\-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
De originele UTF\-16\-codering van het invoerbestand behouden. Het
uitvoerbestand wordt in dezelfde UTF\-16\-codering (little endian of big
endian) geschreven als het invoerbestand. Dit voorkomt conversie naar
\&\s-1UTF\-8. \s0 Er wordt ook een corresponderende \s-1UTF\-16\-BOM\s0 geschreven. Deze optie
kan uitgeschakeld worden met de optie \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul\fR, \fB\-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16LE\s0 is.
.Sp
Wanneer het invoerbestand een Byte-Order-Mark (\s-1BOM\s0) bevat, dan gaat deze \s-1BOM\s0
vóór deze optie.
.Sp
Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen
\&\s-1UTF\-16LE\s0) en de conversie verliep met succes, dan krijgt u een UTF\-8\-bestand
met verkeerde tekst. De verkeerde conversie kan ongedaan worden gemaakt
door met \fIiconv\fR\|(1) het UTF\-8\-uitvoerbestand terug om te zetten naar
\&\s-1UTF\-16LE. \s0 Dit zal het originele bestand terug brengen.
.Sp
De aanname van \s-1UTF\-16LE\s0 werkt als een \fIconversiemodus\fR. Door de
standaardmodus \fIascii\fR in te schakelen wordt de UTF\-16LE\-veronderstelling
uitgeschakeld.
.IP "\fB\-ub\fR, \fB\-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16BE\s0 is.
.Sp
Deze optie werkt hetzelfde als optie \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
.IX Item "-v, --verbose"
Extra meldingen weergeven. Er wordt extra informatie getoond over
Byte-Order-Marks en het aantal geconverteerde regeleindes.
.IP "\fB\-F\fR, \fB\-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Symbolische koppelingen volgen en de doelen converteren.
.IP "\fB\-R\fR, \fB\-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Symbolische koppelingen vervangen door geconverteerde bestanden (de
originele doelbestanden blijven ongewijzigd).
.IP "\fB\-S\fR, \fB\-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Symbolische koppelingen en doelen ongewijzigd laten (standaard).
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
.IX Item "-V, --version"
Versie-informatie tonen.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa.
Mac-regeleindes worden niet omgezet.
.PP
In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa.
DOS-regeleindes blijven ongewijzigd.
.PP
Om in Mac-modus te draaien kunt u de opdrachtregeloptie \f(CW\*(C`\-c mac\*(C'\fR gebruiken,
of de opdrachten \f(CW\*(C`mac2unix\*(C'\fR of \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSIEMODI"
.IX Header "CONVERSIEMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In modus \f(CW\*(C`ascii\*(C'\fR worden alleen regeleindes omgezet. Dit is de
standaardmodus.
.Sp
Hoewel de naam van deze modus \s-1ASCII\s0 is, wat een 7\-bits standaard is, is de
werkelijke modus 8\-bits. Gebruik altijd deze modus wanneer u Unicode
UTF\-8\-bestanden omzet.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Alle 8\-bits niet-ASCII lettertekens (met waardes van 128 t/m 255) worden
omgezet naar een 7\-bits spatie.
.IP "\fBiso\fR" 4
.IX Item "iso"
Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de ISO-tekenset
\&\s-1ISO\-8859\-1 \s0(Latin\-1) op Unix. DOS-tekens zonder een ISO\-8859\-1\-equivalent,
waarvoor dus geen omzetting mogelijk is, worden omgezet in een punt.
Hetzelfde geldt voor ISO\-8859\-1\-tekens zonder DOS-tegenhanger.
.Sp
Wanneer alleen optie \f(CW\*(C`\-iso\*(C'\fR gebruikt wordt, zal dos2unix proberen de
actieve codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel
\&\s-1CP437\s0 gebruikt, die vooral in de \s-1VS\s0 gebruikt wordt. Om een bepaalde
codetabel te forceren, kunt u de opties \f(CW\*(C`\-850\*(C'\fR (West-Europees), \f(CW\*(C`\-860\*(C'\fR
(Portugees), \f(CW\*(C`\-863\*(C'\fR (Canadees Frans) of \f(CW\*(C`\-865\*(C'\fR (Scandinavisch) gebruiken.
Windows-codetabel \s-1CP1252 \s0(West-Europees) wordt ook ondersteund met optie
\&\f(CW\*(C`\-1252\*(C'\fR. Gebruik voor andere codetabellen dos2unix in combinatie met
\&\fIiconv\fR\|(1). Iconv kan omzetten tussen een lange lijst tekensetcoderingen.
.Sp
Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal
UTF\-8\-gecodeerde bestanden beschadigen.
.Sp
Enkele voorbeelden:
.Sp
Omzetten van de standaard DOS-codetabel naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van \s-1DOS CP850\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar de standaard DOS-codetabel:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix \s-1UTF\-8 \s0(Unicode) naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > uit.txt
.Ve
.Sp
Zie ook <http://czyborra.com/charsets/codepages.html> en
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Coderingen"
.IX Subsection "Coderingen"
Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn
Unicode-bestanden typisch gecodeerd in \s-1UTF\-8. \s0 Op Windows kunnen
Unicode-tekstbestanden gecodeerd zijn in \s-1UTF\-8, UTF\-16\s0 of \s-1UTF\-16\s0 big endian,
maar ze zijn meestal gecodeerd in \s-1UTF\-16.\s0
.SS "Conversie"
.IX Subsection "Conversie"
Unicode-tekstbestanden kunnen \s-1DOS\-,\s0 Unix\- of Mac-regeleindes hebben, net als
reguliere tekstbestanden.
.PP
Alle versies van dos2unix en unix2dos kunnen UTF\-8\-gecodeerde bestanden
omzetten, want \s-1UTF\-8\s0 is ontworpen op compatibiliteit met \s-1ASCII.\s0
.PP
Dos2unix en unix2dos met Unicode UTF\-16\-ondersteuning kunnen little en big
endian UTF\-16\-gecodeerde tekstbestanden lezen. Om er achter te komen of
dos2unix gebouwd is met \s-1UTF\-16\-\s0 ondersteuning, typt u \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Op Unix/Linux worden UTF\-16\-bestanden geconverteerd naar de codering van de
ingestelde taalregio. Gebruik de opdracht \fBlocale\fR(1) om te zien wat de
ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er een
fout op en wordt het bestand overgeslagen.
.PP
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd.
UTF\-8\-tekstbestanden worden alom goed ondersteund, zowel op Windows als
Unix/Linux.
.PP
De \s-1UTF\-16\-\s0 en UTF\-8\-coderingen zijn volledig compatibel, er gaat bij het
converteren niets verloren. Als er tijdens de conversie van \s-1UTF\-16\s0 naar
\&\s-1UTF\-8\s0 een fout optreedt, bijvoorbeeld omdat het UTF\-16\-invoerbestand een
fout bevat, dan wordt het bestand overgeslagen.
.PP
Wanneer \f(CW\*(C`\-u\*(C'\fR gebruikt wordt, wordt het uitvoerbestand in dezelfde
UTF\-16\-codering geschreven als het invoerbestand. Optie \f(CW\*(C`\-u\*(C'\fR voorkomt
conversie naar \s-1UTF\-8.\s0
.PP
Dos2unix en unix2dos hebben geen optie om van \s-1UTF\-8\s0 naar \s-1UTF\-16\s0 te
converteren.
.PP
\&\s-1ISO\-\s0 en 7\-bits\-conversie werken niet op UTF\-16\-bestanden.
.SS "Byte-Order-Mark"
.IX Subsection "Byte-Order-Mark"
Op Windows bevatten Unicode-tekstbestanden gewoonlijk een Byte-Order-Mark
(\s-1BOM\s0), omdat veel Windows-programma's (inclusief Kladblok) standaard een \s-1BOM\s0
toevoegen. Zie ook <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
Op Unix hebben Unicode-tekstbestanden meestal geen \s-1BOM. \s0 Er wordt aangenomen
dat de codering van tekstbestanden gelijk is aan de tekencodering van de
ingestelde taalregio.
.PP
Dos2unix kan alleen detecteren of een bestand in UTF\-16\-codering is als het
bestand een \s-1BOM\s0 bevat. Wanneer een UTF\-16\-bestand geen \s-1BOM\s0 heeft, ziet
dos2unix het bestand als een binair bestand.
.PP
Gebruik optie \f(CW\*(C`\-ul\*(C'\fR of \f(CW\*(C`\-ub\*(C'\fR om een UTF\-16\-bestand zonder \s-1BOM\s0 om te
zetten.
.PP
Dos2unix schrijft standaard geen \s-1BOM\s0 in het uitvoerbestand. Met optie \f(CW\*(C`\-b\*(C'\fR
schrijft dos2unix een \s-1BOM\s0 wanneer het invoerbestand een \s-1BOM\s0 bevat.
.PP
Unix2dos schrijft standaard een \s-1BOM\s0 in het uitvoerbestand wanneer het
invoerbestand een \s-1BOM\s0 bevat. Gebruik optie \f(CW\*(C`\-r\*(C'\fR om de \s-1BOM\s0 te verwijderen.
.PP
Dos2unix en unix2dos schrijven altijd een \s-1BOM\s0 wanneer optie \f(CW\*(C`\-m\*(C'\fR gebruikt
wordt.
.SS "Unicode-voorbeelden"
.IX Subsection "Unicode-voorbeelden"
Omzetten van Windows \s-1UTF\-16 \s0(met \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt uit.txt
.Ve
.PP
Omzetten van Windows \s-1UTF\-16LE \s0(zonder \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-8\s0 met \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > uit.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is een standaard van de Chinese overheid. Een subset van de
GB18030\-standaard is officieel verplicht voor alle softwareproducten die in
China verkocht worden. Zie ook <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is volledig compatibel met Unicode, en kan als een
Unicodetransformatie beschouwd worden. Net als \s-1UTF\-8\s0 is \s-1GB18030\s0 compatibel
met \s-1ASCII. GB18030\s0 is ook compatibel met Windows-codetabel 936 (ook wel \s-1GBK\s0
genoemd).
.PP
Op Unix/Linux worden UTF\-16\-bestanden alleen naar \s-1GB18030\s0 geconverteerd
wanneer de taalregio op China ingesteld is en de codering op \s-1GB18030.\s0
Bijvoorbeeld, met de Britse taalregio-instelling \f(CW\*(C`en_GB.GB18030\*(C'\fR zal
conversie van \s-1UTF\-16\s0 naar \s-1GB18030\s0 niet werken, maar met de Chinese
instelling \f(CW\*(C`zh_CN.GB18030\*(C'\fR wel.
.PP
Op Windows dient u de optie \f(CW\*(C`\-gb\*(C'\fR te gebruiken om UTF\-16\-bestanden naar
\&\s-1GB18030\s0 te converteren.
.PP
GB18030\-bestanden kunnen een Byte-Order-Mark bevatten, net als
Unicode-bestanden.
.SH "VOORBEELDEN"
.IX Header "VOORBEELDEN"
Invoer lezen van standaardinvoer en uitvoer schrijven naar standaarduitvoer:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en
vervangen van b.txt in 7\-bits conversiemodus:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Omzetten van a.txt van Mac\- naar Unix-indeling:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Omzetten van a.txt van Unix\- naar Mac-indeling:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Omzetten van a.txt en resultaat naar e.txt schrijven:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt
gelijk aan die van a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt schrijven:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van a.txt;
omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt schrijven.
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIEVE CONVERSIE"
.IX Header "RECURSIEVE CONVERSIE"
Gebruik dos2unix in combinatie met de opdrachten \fBfind\fR(1) en \fBxargs\fR(1)
om tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om
alle .txt\-bestanden in de mappenboom onder de huidige map te converteren,
typt u:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISATIE"
.IX Header "LOKALISATIE"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
De primaire taal wordt geselecteerd via de omgevingsvariabele \s-1LANG. \s0 De
variabele \s-1LANG\s0 bestaat uit verschillende onderdelen. Het eerste deel is in
kleine letters de taalcode. Het tweede deel is optioneel en is de landcode
in hoofdletters, voorafgegaan door een liggend streepje. Er is ook een
optioneel derde deel: de tekencodering, voorafgegaan door een punt. Enkele
voorbeelden voor een POSIX-shell:
.Sp
.Vb 7
\& export LANG=nl Nederlands
\& export LANG=nl_NL Nederlands, Nederland
\& export LANG=nl_BE Nederlands, België
\& export LANG=es_ES Spaans, Spanje
\& export LANG=es_MX Spaans, Mexico
\& export LANG=en_US.iso88591 Engels, VS, Latin\-1\-codering
\& export LANG=en_GB.UTF\-8 Engels, GB, UTF\-8\-codering
.Ve
.Sp
Voor een complete lijst van taal\- en landcodes zie de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Op Unix-systemen kunt u de opdracht \fBlocale\fR(1) gebruiken om specifieke
taalregio-informatie te verkrijgen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Met de omgevingsvariabele \s-1LANGUAGE\s0 kunt u een prioriteitenlijst specificeren
van talen, gescheiden door dubbele punten. Dos2unix geeft voorrang aan
\&\s-1LANGUAGE\s0 boven \s-1LANG. \s0 Bijvoorbeeld, eerst Nederlands en dan Duits:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. U moet eerst lokalisatie in werking stellen, door het
instellen van \s-1LANG \s0(of \s-1LC_ALL\s0) op een waarde ongelijk aan \*(L"C\*(R", voordat u een
talen-prioriteitenlijst kunt gebruiken via de variabele \s-1LANGUAGE. \s0 Zie ook
de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Als u een taal kiest die niet beschikbaar is, worden de standaard Engelse
berichten gebruikt.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Met de omgevingsvariabele \s-1DOS2UNIX_LOCALEDIR\s0 kan de \s-1LOCALEDIR\s0 die ingesteld
werd tijdens compilatie worden overstemd. \s-1LOCALEDIR\s0 wordt gebruikt om de
taalbestanden te vinden. De \s-1GNU\s0 standaardwaarde is
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. De optie \fB\-\-version\fR laat de gebruikte
\&\s-1LOCALEDIR\s0 zien.
.Sp
Voorbeeld (POSIX-shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "AFSLUITWAARDE"
.IX Header "AFSLUITWAARDE"
Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt wordt
het laatste systeemfoutnummer teruggegeven. Bij andere fouten wordt 1
teruggegeven.
.PP
De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve wanneer
verkeerde opties worden gegeven.
.SH "STANDAARDEN"
.IX Header "STANDAARDEN"
<http://nl.wikipedia.org/wiki/Tekstbestand>
.PP
<http://nl.wikipedia.org/wiki/Carriage_Return>
.PP
<http://nl.wikipedia.org/wiki/Linefeed>
.PP
<http://nl.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(mac2unix\-modus) \- <wuebben@kde.org>, Christian Wurll (toevoegen van extra
regeleindes) \- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl>
(beheerder)
.PP
Projectpagina: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-pagina: <http://sourceforge.net/projects/dos2unix/>
.SH "ZIE OOK"
.IX Header "ZIE OOK"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,761 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAAM"
.IX Header "NAAM"
dos2unix \- omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix en
vice versa
.SH "OVERZICHT"
.IX Header "OVERZICHT"
.Vb 2
\& dos2unix [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
\& unix2dos [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
.Ve
.SH "BESCHRIJVING"
.IX Header "BESCHRIJVING"
Het Dos2unix pakket bevat de toepassingen \f(CW\*(C`dos2unix\*(C'\fR en \f(CW\*(C`unix2dos\*(C'\fR om
platte tekstbestanden in \s-1DOS\-\s0 of Mac-indeling naar Unix-indeling om te
zetten, en vice versa.
.PP
In DOS/Windows\-tekstbestanden bestaat een regeleinde uit een combinatie van
twee tekens: een 'Carriage Return' (\s-1CR\s0) gevolgd door een 'Line Feed' (\s-1LF\s0).
In Unix-tekstbestanden bestaat een regeleinde uit één enkel 'Newline'\-teken,
dat gelijk is aan een \s-1DOS \s0'Line Feed'-teken (\s-1LF\s0). In Mac-tekstbestanden,
van vóór Mac \s-1OS X,\s0 bestaan regeleindes uit één enkel 'Carriage
Return'-teken. Mac \s-1OS X\s0 is op Unix gebaseerd en heeft dezelfde regeleindes
als Unix.
.PP
Naast regeleindes kan Dos2unix ook de codering van bestanden converteren.
Enkele DOS-codetabellen kunnen omgezet worden naar Unix Latin\-1. En Windows
Unicode-bestanden (\s-1UTF\-16\s0) kunnen geconverteerd worden naar Unix
Unicode-bestanden (\s-1UTF\-8\s0).
.PP
Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting
geforceerd wordt.
.PP
Niet-reguliere bestanden, zoals mappen en \s-1FIFO\s0's, worden automatisch
overgeslagen.
.PP
Symbolische koppelingen en hun doelen blijven standaard onaangeroerd.
Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer kan
naar het doel van de symbolische koppeling worden geschreven. Op Windows
wordt het schrijven naar het doel van een symbolische koppeling niet
ondersteund.
.PP
Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is één
belangrijk verschil: deze versie van dos2unix voert standaard een
vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke
SunOS/Solaris\-versie alleen de gepaarde conversie (nieuw-bestand-modus)
kent. Zie ook de opties \f(CW\*(C`\-o\*(C'\fR en \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIES"
.IX Header "OPTIES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Alle volgende opties als bestandsnamen behandelen. Gebruik deze optie als u
een bestand wilt converteren waarvan de naam met een streepje begint.
Bijvoorbeeld, om een bestand genaamd \*(L"\-foo\*(R" om te zetten, gebruikt u de
volgende opdracht:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Of in nieuw-bestand-modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo uit.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Alleen regeleindes converteren. Dit is de standaardconversiemodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversie tussen de tekensets \s-1DOS\s0 en \s-1ISO\-8859\-1. \s0 Zie ook de sectie
\&\s-1CONVERSIEMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Windows-codetabel 1252 (West-Europees) gebruiken.
.IP "\fB\-437\fR" 4
.IX Item "-437"
DOS-codetabel 437 (\s-1VS\s0) gebruiken. Dit is de standaard codetabel die
gebruikt wordt bij ISO-conversie.
.IP "\fB\-850\fR" 4
.IX Item "-850"
DOS-codetabel 850 (West-Europees) gebruiken.
.IP "\fB\-860\fR" 4
.IX Item "-860"
DOS-codetabel 860 (Portugees) gebruiken.
.IP "\fB\-863\fR" 4
.IX Item "-863"
DOS-codetabel 863 (Canadees Frans) gebruiken.
.IP "\fB\-865\fR" 4
.IX Item "-865"
DOS-codetabel 865 (Scandinavisch) gebruiken.
.IP "\fB\-7\fR" 4
.IX Item "-7"
Lettertekens met het achtste bit gezet converteren naar spaties.
.IP "\fB\-b\fR, \fB\-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Een Byte-Order-Mark (\s-1BOM\s0) behouden. Als het invoerbestand een \s-1BOM\s0 bevat,
dan wordt ook een \s-1BOM\s0 naar het uitvoerbestand geschreven. Dit is het
standaardgedrag bij conversie naar \s-1DOS. \s0 Zie ook optie \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c\fR, \fB\-\-convmode \s-1CONVERSIEMODUS\s0\fR" 4
.IX Item "-c, --convmode CONVERSIEMODUS"
De te gebruiken conversiemodus. \s-1CONVERSIEMODUS\s0 kan zijn: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, of \fImac\fR, waarbij ascii de standaardinstelling is.
.IP "\fB\-f\fR, \fB\-\-force\fR" 4
.IX Item "-f, --force"
Conversie van binaire bestanden afdwingen.
.IP "\fB\-gb\fR, \fB\-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd,
ongeacht de ingestelde taalregio. Gebruik deze optie om UTF\-16\-bestanden
naar \s-1GB18030\s0 te converteren. Deze optie is alleen beschikbaar op Windows.
Zie ook de sectie \fB\s-1GB18030\s0\fR.
.IP "\fB\-h\fR, \fB\-\-help\fR" 4
.IX Item "-h, --help"
Een hulptekst tonen.
.IP "\fB\-i\fR[\fB\s-1VLAGGEN\s0\fR], \fB\-\-info\fR[\fB=VLAGGEN\fR] \fB\s-1BESTAND\s0\fR..." 4
.IX Item "-i[VLAGGEN], --info[=VLAGGEN] BESTAND..."
Bestandsinformatie tonen. Er wordt niets geconverteerd.
.Sp
De volgende informatie wordt weergegeven, in deze volgorde: het aantal
DOS-regeleindes, het aantal Unix-regeleindes, het aantal Mac-regeleindes, de
Byte-Order-Mark, of het een tekst\- of binair bestand is, en de bestandsnaam.
.Sp
Voorbeelduitvoer:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Bij de optie kunnen één of meer vlaggen meegegeven worden om de uitvoer te
beperken.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Het aantal DOS-regeleindes tonen.
.IP "\fBu\fR" 4
.IX Item "u"
Het aantal Unix-regeleindes tonen.
.IP "\fBm\fR" 4
.IX Item "m"
Het aantal Mac-regeleindes tonen.
.IP "\fBb\fR" 4
.IX Item "b"
De Byte-Order-Mark tonen.
.IP "\fBt\fR" 4
.IX Item "t"
Tonen of het bestand tekst is of binair.
.IP "\fBc\fR" 4
.IX Item "c"
Alleen de namen tonen van de bestanden die geconverteerd zouden worden.
.Sp
Met de vlag \f(CW\*(C`c\*(C'\fR toont dos2unix alleen de bestanden die DOS-regeleindes
bevatten, en unix2dos alleen de bestanden die Unix-regeleindes bevatten.
.RE
.RS 4
.Sp
Voorbeelden:
.Sp
Informatie weergeven voor alle bestanden met de extensie 'txt':
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Alleen de Byte-Order-Mark tonen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
De bestanden opsommen die DOS-regeleindes bevatten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
De bestanden opsommen die Unix-regeleindes bevatten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k\fR, \fB\-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Het tijdsstempel van het invoerbestand behouden voor het uitvoerbestand.
.IP "\fB\-L\fR, \fB\-\-license\fR" 4
.IX Item "-L, --license"
De softwarelicentie tonen.
.IP "\fB\-l\fR, \fB\-\-newline\fR" 4
.IX Item "-l, --newline"
Een extra regeleinde toevoegen.
.Sp
\&\fBdos2unix\fR: Alleen DOS-regeleindes worden omgezet naar twee
Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet naar
twee Unix-regeleindes.
.Sp
\&\fBunix2dos\fR: Alleen Unix-regeleindes worden omgezet naar twee
DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar twee
Mac-regeleindes.
.IP "\fB\-m\fR, \fB\-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Een Byte-Order-Mark (\s-1BOM\s0) naar het uitvoerbestand schrijven. Standaard
wordt een \s-1UTF\-8\-BOM\s0 geschreven.
.Sp
Als het invoerbestand in \s-1UTF\-16\s0 is, en de optie \f(CW\*(C`\-u\*(C'\fR is gegeven, dan wordt
een \s-1UTF\-16\-BOM\s0 geschreven.
.Sp
Gebruik deze optie nooit als de codering van het uitvoerbestand niet \s-1UTF\-8\s0
of \s-1UTF\-16\s0 is. Zie ook de sectie \s-1UNICODE.\s0
.IP "\fB\-n\fR, \fB\-\-newfile \s-1INVOERBESTAND UITVOERBESTAND\s0\fR ..." 4
.IX Item "-n, --newfile INVOERBESTAND UITVOERBESTAND ..."
Nieuw-bestand-modus. Het bestand \s-1INVOERBESTAND\s0 converteren en naar bestand
\&\s-1UITVOERBESTAND\s0 schrijven. Bestandsnamen moeten opgegeven worden in paren.
Jokertekens moeten \fIniet\fRgebruikt worden, anders \fIverlies\fR je de
bestanden.
.Sp
De gebruiker die de conversie start in nieuw-bestand (gepaarde) modus wordt
de eigenaar van het geconverteerde bestand. De lees/schrijf\-toegangsrechten
van het nieuwe bestand worden de toegangsrechten van het originele bestand
minus de \fIumask\fR\|(1) van de gebruiker die de conversie draait.
.IP "\fB\-o\fR, \fB\-\-oldfile \s-1BESTAND\s0\fR ..." 4
.IX Item "-o, --oldfile BESTAND ..."
Oud-bestand-modus. Het bestand \s-1BESTAND\s0 converteren en overschrijven. Dit
is de standaard modus. Jokertekens kunnen gebruikt worden.
.Sp
In oud-bestand (vervangende) modus krijgt het geconverteerde bestand
dezelfde eigenaar, groep en lees/schrijf\-rechten als het originele bestand.
Ook wanneer het bestand wordt omgezet door een andere gebruiker die
schrijfrechten heeft op het bestand (b.v. gebruiker root). De omzetting
wordt afgebroken wanneer het niet mogelijk is de originele waardes te
behouden. Verandering van eigenaar kan betekenen dat de originele eigenaar
het bestand niet meer kan lezen. Verandering van groep zou een
veiligheidsrisico kunnen zijn, het bestand zou leesbaar kunnen worden voor
personen voor wie het niet bestemd is. Behoud van eigenaar, groep en
lees/schrijf\-rechten wordt alleen ondersteund op Unix.
.IP "\fB\-q\fR, \fB\-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde is nul,
behalve wanneer verkeerde opties worden gegeven.
.IP "\fB\-r\fR, \fB\-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Een Byte-Order-Mark (\s-1BOM\s0) verwijderen. Er wordt geen \s-1BOM\s0 naar het
uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar
Unix. Zie ook optie \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s\fR, \fB\-\-safe\fR" 4
.IX Item "-s, --safe"
Binaire bestanden overslaan (standaard).
.IP "\fB\-u\fR, \fB\-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
De originele UTF\-16\-codering van het invoerbestand behouden. Het
uitvoerbestand wordt in dezelfde UTF\-16\-codering (little endian of big
endian) geschreven als het invoerbestand. Dit voorkomt conversie naar
\&\s-1UTF\-8. \s0 Er wordt ook een corresponderende \s-1UTF\-16\-BOM\s0 geschreven. Deze optie
kan uitgeschakeld worden met de optie \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul\fR, \fB\-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16LE\s0 is.
.Sp
Wanneer het invoerbestand een Byte-Order-Mark (\s-1BOM\s0) bevat, dan gaat deze \s-1BOM\s0
vóór deze optie.
.Sp
Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen
\&\s-1UTF\-16LE\s0) en de conversie verliep met succes, dan krijgt u een UTF\-8\-bestand
met verkeerde tekst. De verkeerde conversie kan ongedaan worden gemaakt
door met \fIiconv\fR\|(1) het UTF\-8\-uitvoerbestand terug om te zetten naar
\&\s-1UTF\-16LE. \s0 Dit zal het originele bestand terug brengen.
.Sp
De aanname van \s-1UTF\-16LE\s0 werkt als een \fIconversiemodus\fR. Door de
standaardmodus \fIascii\fR in te schakelen wordt de UTF\-16LE\-veronderstelling
uitgeschakeld.
.IP "\fB\-ub\fR, \fB\-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16BE\s0 is.
.Sp
Deze optie werkt hetzelfde als optie \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
.IX Item "-v, --verbose"
Extra meldingen weergeven. Er wordt extra informatie getoond over
Byte-Order-Marks en het aantal geconverteerde regeleindes.
.IP "\fB\-F\fR, \fB\-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Symbolische koppelingen volgen en de doelen converteren.
.IP "\fB\-R\fR, \fB\-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Symbolische koppelingen vervangen door geconverteerde bestanden (de
originele doelbestanden blijven ongewijzigd).
.IP "\fB\-S\fR, \fB\-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Symbolische koppelingen en doelen ongewijzigd laten (standaard).
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
.IX Item "-V, --version"
Versie-informatie tonen.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa.
Mac-regeleindes worden niet omgezet.
.PP
In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa.
DOS-regeleindes blijven ongewijzigd.
.PP
Om in Mac-modus te draaien kunt u de opdrachtregeloptie \f(CW\*(C`\-c mac\*(C'\fR gebruiken,
of de opdrachten \f(CW\*(C`mac2unix\*(C'\fR of \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSIEMODI"
.IX Header "CONVERSIEMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In modus \f(CW\*(C`ascii\*(C'\fR worden alleen regeleindes omgezet. Dit is de
standaardmodus.
.Sp
Hoewel de naam van deze modus \s-1ASCII\s0 is, wat een 7\-bits standaard is, is de
werkelijke modus 8\-bits. Gebruik altijd deze modus wanneer u Unicode
UTF\-8\-bestanden omzet.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Alle 8\-bits niet-ASCII lettertekens (met waardes van 128 t/m 255) worden
omgezet naar een 7\-bits spatie.
.IP "\fBiso\fR" 4
.IX Item "iso"
Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de ISO-tekenset
\&\s-1ISO\-8859\-1 \s0(Latin\-1) op Unix. DOS-tekens zonder een ISO\-8859\-1\-equivalent,
waarvoor dus geen omzetting mogelijk is, worden omgezet in een punt.
Hetzelfde geldt voor ISO\-8859\-1\-tekens zonder DOS-tegenhanger.
.Sp
Wanneer alleen optie \f(CW\*(C`\-iso\*(C'\fR gebruikt wordt, zal dos2unix proberen de
actieve codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel
\&\s-1CP437\s0 gebruikt, die vooral in de \s-1VS\s0 gebruikt wordt. Om een bepaalde
codetabel te forceren, kunt u de opties \f(CW\*(C`\-850\*(C'\fR (West-Europees), \f(CW\*(C`\-860\*(C'\fR
(Portugees), \f(CW\*(C`\-863\*(C'\fR (Canadees Frans) of \f(CW\*(C`\-865\*(C'\fR (Scandinavisch) gebruiken.
Windows-codetabel \s-1CP1252 \s0(West-Europees) wordt ook ondersteund met optie
\&\f(CW\*(C`\-1252\*(C'\fR. Gebruik voor andere codetabellen dos2unix in combinatie met
\&\fIiconv\fR\|(1). Iconv kan omzetten tussen een lange lijst tekensetcoderingen.
.Sp
Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal
UTF\-8\-gecodeerde bestanden beschadigen.
.Sp
Enkele voorbeelden:
.Sp
Omzetten van de standaard DOS-codetabel naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van \s-1DOS CP850\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar de standaard DOS-codetabel:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix \s-1UTF\-8 \s0(Unicode) naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > uit.txt
.Ve
.Sp
Zie ook <http://czyborra.com/charsets/codepages.html> en
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Coderingen"
.IX Subsection "Coderingen"
Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn
Unicode-bestanden typisch gecodeerd in \s-1UTF\-8. \s0 Op Windows kunnen
Unicode-tekstbestanden gecodeerd zijn in \s-1UTF\-8, UTF\-16\s0 of \s-1UTF\-16\s0 big endian,
maar ze zijn meestal gecodeerd in \s-1UTF\-16.\s0
.SS "Conversie"
.IX Subsection "Conversie"
Unicode-tekstbestanden kunnen \s-1DOS\-,\s0 Unix\- of Mac-regeleindes hebben, net als
reguliere tekstbestanden.
.PP
Alle versies van dos2unix en unix2dos kunnen UTF\-8\-gecodeerde bestanden
omzetten, want \s-1UTF\-8\s0 is ontworpen op compatibiliteit met \s-1ASCII.\s0
.PP
Dos2unix en unix2dos met Unicode UTF\-16\-ondersteuning kunnen little en big
endian UTF\-16\-gecodeerde tekstbestanden lezen. Om er achter te komen of
dos2unix gebouwd is met \s-1UTF\-16\-\s0 ondersteuning, typt u \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Op Unix/Linux worden UTF\-16\-bestanden geconverteerd naar de codering van de
ingestelde taalregio. Gebruik de opdracht \fBlocale\fR(1) om te zien wat de
ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er een
fout op en wordt het bestand overgeslagen.
.PP
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd.
UTF\-8\-tekstbestanden worden alom goed ondersteund, zowel op Windows als
Unix/Linux.
.PP
De \s-1UTF\-16\-\s0 en UTF\-8\-coderingen zijn volledig compatibel, er gaat bij het
converteren niets verloren. Als er tijdens de conversie van \s-1UTF\-16\s0 naar
\&\s-1UTF\-8\s0 een fout optreedt, bijvoorbeeld omdat het UTF\-16\-invoerbestand een
fout bevat, dan wordt het bestand overgeslagen.
.PP
Wanneer \f(CW\*(C`\-u\*(C'\fR gebruikt wordt, wordt het uitvoerbestand in dezelfde
UTF\-16\-codering geschreven als het invoerbestand. Optie \f(CW\*(C`\-u\*(C'\fR voorkomt
conversie naar \s-1UTF\-8.\s0
.PP
Dos2unix en unix2dos hebben geen optie om van \s-1UTF\-8\s0 naar \s-1UTF\-16\s0 te
converteren.
.PP
\&\s-1ISO\-\s0 en 7\-bits\-conversie werken niet op UTF\-16\-bestanden.
.SS "Byte-Order-Mark"
.IX Subsection "Byte-Order-Mark"
Op Windows bevatten Unicode-tekstbestanden gewoonlijk een Byte-Order-Mark
(\s-1BOM\s0), omdat veel Windows-programma's (inclusief Kladblok) standaard een \s-1BOM\s0
toevoegen. Zie ook <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
Op Unix hebben Unicode-tekstbestanden meestal geen \s-1BOM. \s0 Er wordt aangenomen
dat de codering van tekstbestanden gelijk is aan de tekencodering van de
ingestelde taalregio.
.PP
Dos2unix kan alleen detecteren of een bestand in UTF\-16\-codering is als het
bestand een \s-1BOM\s0 bevat. Wanneer een UTF\-16\-bestand geen \s-1BOM\s0 heeft, ziet
dos2unix het bestand als een binair bestand.
.PP
Gebruik optie \f(CW\*(C`\-ul\*(C'\fR of \f(CW\*(C`\-ub\*(C'\fR om een UTF\-16\-bestand zonder \s-1BOM\s0 om te
zetten.
.PP
Dos2unix schrijft standaard geen \s-1BOM\s0 in het uitvoerbestand. Met optie \f(CW\*(C`\-b\*(C'\fR
schrijft dos2unix een \s-1BOM\s0 wanneer het invoerbestand een \s-1BOM\s0 bevat.
.PP
Unix2dos schrijft standaard een \s-1BOM\s0 in het uitvoerbestand wanneer het
invoerbestand een \s-1BOM\s0 bevat. Gebruik optie \f(CW\*(C`\-r\*(C'\fR om de \s-1BOM\s0 te verwijderen.
.PP
Dos2unix en unix2dos schrijven altijd een \s-1BOM\s0 wanneer optie \f(CW\*(C`\-m\*(C'\fR gebruikt
wordt.
.SS "Unicode-voorbeelden"
.IX Subsection "Unicode-voorbeelden"
Omzetten van Windows \s-1UTF\-16 \s0(met \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt uit.txt
.Ve
.PP
Omzetten van Windows \s-1UTF\-16LE \s0(zonder \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-8\s0 met \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > uit.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is een standaard van de Chinese overheid. Een subset van de
GB18030\-standaard is officieel verplicht voor alle softwareproducten die in
China verkocht worden. Zie ook <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is volledig compatibel met Unicode, en kan als een
Unicodetransformatie beschouwd worden. Net als \s-1UTF\-8\s0 is \s-1GB18030\s0 compatibel
met \s-1ASCII. GB18030\s0 is ook compatibel met Windows-codetabel 936 (ook wel \s-1GBK\s0
genoemd).
.PP
Op Unix/Linux worden UTF\-16\-bestanden alleen naar \s-1GB18030\s0 geconverteerd
wanneer de taalregio op China ingesteld is en de codering op \s-1GB18030.\s0
Bijvoorbeeld, met de Britse taalregio-instelling \f(CW\*(C`en_GB.GB18030\*(C'\fR zal
conversie van \s-1UTF\-16\s0 naar \s-1GB18030\s0 niet werken, maar met de Chinese
instelling \f(CW\*(C`zh_CN.GB18030\*(C'\fR wel.
.PP
Op Windows dient u de optie \f(CW\*(C`\-gb\*(C'\fR te gebruiken om UTF\-16\-bestanden naar
\&\s-1GB18030\s0 te converteren.
.PP
GB18030\-bestanden kunnen een Byte-Order-Mark bevatten, net als
Unicode-bestanden.
.SH "VOORBEELDEN"
.IX Header "VOORBEELDEN"
Invoer lezen van standaardinvoer en uitvoer schrijven naar standaarduitvoer:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en
vervangen van b.txt in 7\-bits conversiemodus:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Omzetten van a.txt van Mac\- naar Unix-indeling:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Omzetten van a.txt van Unix\- naar Mac-indeling:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Omzetten van a.txt en resultaat naar e.txt schrijven:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt
gelijk aan die van a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt schrijven:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van a.txt;
omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt schrijven.
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIEVE CONVERSIE"
.IX Header "RECURSIEVE CONVERSIE"
Gebruik dos2unix in combinatie met de opdrachten \fBfind\fR(1) en \fBxargs\fR(1)
om tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om
alle .txt\-bestanden in de mappenboom onder de huidige map te converteren,
typt u:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISATIE"
.IX Header "LOKALISATIE"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
De primaire taal wordt geselecteerd via de omgevingsvariabele \s-1LANG. \s0 De
variabele \s-1LANG\s0 bestaat uit verschillende onderdelen. Het eerste deel is in
kleine letters de taalcode. Het tweede deel is optioneel en is de landcode
in hoofdletters, voorafgegaan door een liggend streepje. Er is ook een
optioneel derde deel: de tekencodering, voorafgegaan door een punt. Enkele
voorbeelden voor een POSIX-shell:
.Sp
.Vb 7
\& export LANG=nl Nederlands
\& export LANG=nl_NL Nederlands, Nederland
\& export LANG=nl_BE Nederlands, België
\& export LANG=es_ES Spaans, Spanje
\& export LANG=es_MX Spaans, Mexico
\& export LANG=en_US.iso88591 Engels, VS, Latin\-1\-codering
\& export LANG=en_GB.UTF\-8 Engels, GB, UTF\-8\-codering
.Ve
.Sp
Voor een complete lijst van taal\- en landcodes zie de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Op Unix-systemen kunt u de opdracht \fBlocale\fR(1) gebruiken om specifieke
taalregio-informatie te verkrijgen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Met de omgevingsvariabele \s-1LANGUAGE\s0 kunt u een prioriteitenlijst specificeren
van talen, gescheiden door dubbele punten. Dos2unix geeft voorrang aan
\&\s-1LANGUAGE\s0 boven \s-1LANG. \s0 Bijvoorbeeld, eerst Nederlands en dan Duits:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. U moet eerst lokalisatie in werking stellen, door het
instellen van \s-1LANG \s0(of \s-1LC_ALL\s0) op een waarde ongelijk aan \*(L"C\*(R", voordat u een
talen-prioriteitenlijst kunt gebruiken via de variabele \s-1LANGUAGE. \s0 Zie ook
de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Als u een taal kiest die niet beschikbaar is, worden de standaard Engelse
berichten gebruikt.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Met de omgevingsvariabele \s-1DOS2UNIX_LOCALEDIR\s0 kan de \s-1LOCALEDIR\s0 die ingesteld
werd tijdens compilatie worden overstemd. \s-1LOCALEDIR\s0 wordt gebruikt om de
taalbestanden te vinden. De \s-1GNU\s0 standaardwaarde is
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. De optie \fB\-\-version\fR laat de gebruikte
\&\s-1LOCALEDIR\s0 zien.
.Sp
Voorbeeld (POSIX-shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "AFSLUITWAARDE"
.IX Header "AFSLUITWAARDE"
Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt wordt
het laatste systeemfoutnummer teruggegeven. Bij andere fouten wordt 1
teruggegeven.
.PP
De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve wanneer
verkeerde opties worden gegeven.
.SH "STANDAARDEN"
.IX Header "STANDAARDEN"
<http://nl.wikipedia.org/wiki/Tekstbestand>
.PP
<http://nl.wikipedia.org/wiki/Carriage_Return>
.PP
<http://nl.wikipedia.org/wiki/Linefeed>
.PP
<http://nl.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(mac2unix\-modus) \- <wuebben@kde.org>, Christian Wurll (toevoegen van extra
regeleindes) \- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl>
(beheerder)
.PP
Projectpagina: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-pagina: <http://sourceforge.net/projects/dos2unix/>
.SH "ZIE OOK"
.IX Header "ZIE OOK"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,761 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAAM"
.IX Header "NAAM"
dos2unix \- omzetter van tekstbestandsindelingen, van DOS/Mac naar Unix en
vice versa
.SH "OVERZICHT"
.IX Header "OVERZICHT"
.Vb 2
\& dos2unix [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
\& unix2dos [opties] [BESTAND ...] [\-n INVOERBESTAND UITVOERBESTAND ...]
.Ve
.SH "BESCHRIJVING"
.IX Header "BESCHRIJVING"
Het Dos2unix pakket bevat de toepassingen \f(CW\*(C`dos2unix\*(C'\fR en \f(CW\*(C`unix2dos\*(C'\fR om
platte tekstbestanden in \s-1DOS\-\s0 of Mac-indeling naar Unix-indeling om te
zetten, en vice versa.
.PP
In DOS/Windows\-tekstbestanden bestaat een regeleinde uit een combinatie van
twee tekens: een 'Carriage Return' (\s-1CR\s0) gevolgd door een 'Line Feed' (\s-1LF\s0).
In Unix-tekstbestanden bestaat een regeleinde uit één enkel 'Newline'\-teken,
dat gelijk is aan een \s-1DOS \s0'Line Feed'-teken (\s-1LF\s0). In Mac-tekstbestanden,
van vóór Mac \s-1OS X,\s0 bestaan regeleindes uit één enkel 'Carriage
Return'-teken. Mac \s-1OS X\s0 is op Unix gebaseerd en heeft dezelfde regeleindes
als Unix.
.PP
Naast regeleindes kan Dos2unix ook de codering van bestanden converteren.
Enkele DOS-codetabellen kunnen omgezet worden naar Unix Latin\-1. En Windows
Unicode-bestanden (\s-1UTF\-16\s0) kunnen geconverteerd worden naar Unix
Unicode-bestanden (\s-1UTF\-8\s0).
.PP
Binaire bestanden worden automatisch overgeslagen, behalve als de omzetting
geforceerd wordt.
.PP
Niet-reguliere bestanden, zoals mappen en \s-1FIFO\s0's, worden automatisch
overgeslagen.
.PP
Symbolische koppelingen en hun doelen blijven standaard onaangeroerd.
Optioneel kunnen symbolische koppelingen worden vervangen, of de uitvoer kan
naar het doel van de symbolische koppeling worden geschreven. Op Windows
wordt het schrijven naar het doel van een symbolische koppeling niet
ondersteund.
.PP
Dos2unix is gemodelleerd naar dos2unix op SunOS/Solaris, maar er is één
belangrijk verschil: deze versie van dos2unix voert standaard een
vervangende conversie uit (oud-bestand-modus) terwijl de oorspronkelijke
SunOS/Solaris\-versie alleen de gepaarde conversie (nieuw-bestand-modus)
kent. Zie ook de opties \f(CW\*(C`\-o\*(C'\fR en \f(CW\*(C`\-n\*(C'\fR.
.SH "OPTIES"
.IX Header "OPTIES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Alle volgende opties als bestandsnamen behandelen. Gebruik deze optie als u
een bestand wilt converteren waarvan de naam met een streepje begint.
Bijvoorbeeld, om een bestand genaamd \*(L"\-foo\*(R" om te zetten, gebruikt u de
volgende opdracht:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Of in nieuw-bestand-modus:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo uit.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Alleen regeleindes converteren. Dit is de standaardconversiemodus.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversie tussen de tekensets \s-1DOS\s0 en \s-1ISO\-8859\-1. \s0 Zie ook de sectie
\&\s-1CONVERSIEMODI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Windows-codetabel 1252 (West-Europees) gebruiken.
.IP "\fB\-437\fR" 4
.IX Item "-437"
DOS-codetabel 437 (\s-1VS\s0) gebruiken. Dit is de standaard codetabel die
gebruikt wordt bij ISO-conversie.
.IP "\fB\-850\fR" 4
.IX Item "-850"
DOS-codetabel 850 (West-Europees) gebruiken.
.IP "\fB\-860\fR" 4
.IX Item "-860"
DOS-codetabel 860 (Portugees) gebruiken.
.IP "\fB\-863\fR" 4
.IX Item "-863"
DOS-codetabel 863 (Canadees Frans) gebruiken.
.IP "\fB\-865\fR" 4
.IX Item "-865"
DOS-codetabel 865 (Scandinavisch) gebruiken.
.IP "\fB\-7\fR" 4
.IX Item "-7"
Lettertekens met het achtste bit gezet converteren naar spaties.
.IP "\fB\-b\fR, \fB\-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Een Byte-Order-Mark (\s-1BOM\s0) behouden. Als het invoerbestand een \s-1BOM\s0 bevat,
dan wordt ook een \s-1BOM\s0 naar het uitvoerbestand geschreven. Dit is het
standaardgedrag bij conversie naar \s-1DOS. \s0 Zie ook optie \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c\fR, \fB\-\-convmode \s-1CONVERSIEMODUS\s0\fR" 4
.IX Item "-c, --convmode CONVERSIEMODUS"
De te gebruiken conversiemodus. \s-1CONVERSIEMODUS\s0 kan zijn: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, of \fImac\fR, waarbij ascii de standaardinstelling is.
.IP "\fB\-f\fR, \fB\-\-force\fR" 4
.IX Item "-f, --force"
Conversie van binaire bestanden afdwingen.
.IP "\fB\-gb\fR, \fB\-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd,
ongeacht de ingestelde taalregio. Gebruik deze optie om UTF\-16\-bestanden
naar \s-1GB18030\s0 te converteren. Deze optie is alleen beschikbaar op Windows.
Zie ook de sectie \fB\s-1GB18030\s0\fR.
.IP "\fB\-h\fR, \fB\-\-help\fR" 4
.IX Item "-h, --help"
Een hulptekst tonen.
.IP "\fB\-i\fR[\fB\s-1VLAGGEN\s0\fR], \fB\-\-info\fR[\fB=VLAGGEN\fR] \fB\s-1BESTAND\s0\fR..." 4
.IX Item "-i[VLAGGEN], --info[=VLAGGEN] BESTAND..."
Bestandsinformatie tonen. Er wordt niets geconverteerd.
.Sp
De volgende informatie wordt weergegeven, in deze volgorde: het aantal
DOS-regeleindes, het aantal Unix-regeleindes, het aantal Mac-regeleindes, de
Byte-Order-Mark, of het een tekst\- of binair bestand is, en de bestandsnaam.
.Sp
Voorbeelduitvoer:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Bij de optie kunnen één of meer vlaggen meegegeven worden om de uitvoer te
beperken.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Het aantal DOS-regeleindes tonen.
.IP "\fBu\fR" 4
.IX Item "u"
Het aantal Unix-regeleindes tonen.
.IP "\fBm\fR" 4
.IX Item "m"
Het aantal Mac-regeleindes tonen.
.IP "\fBb\fR" 4
.IX Item "b"
De Byte-Order-Mark tonen.
.IP "\fBt\fR" 4
.IX Item "t"
Tonen of het bestand tekst is of binair.
.IP "\fBc\fR" 4
.IX Item "c"
Alleen de namen tonen van de bestanden die geconverteerd zouden worden.
.Sp
Met de vlag \f(CW\*(C`c\*(C'\fR toont dos2unix alleen de bestanden die DOS-regeleindes
bevatten, en unix2dos alleen de bestanden die Unix-regeleindes bevatten.
.RE
.RS 4
.Sp
Voorbeelden:
.Sp
Informatie weergeven voor alle bestanden met de extensie 'txt':
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Alleen de aantallen DOS-regeleindes en Unix-regeleindes tonen:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Alleen de Byte-Order-Mark tonen:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
De bestanden opsommen die DOS-regeleindes bevatten:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
De bestanden opsommen die Unix-regeleindes bevatten:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k\fR, \fB\-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Het tijdsstempel van het invoerbestand behouden voor het uitvoerbestand.
.IP "\fB\-L\fR, \fB\-\-license\fR" 4
.IX Item "-L, --license"
De softwarelicentie tonen.
.IP "\fB\-l\fR, \fB\-\-newline\fR" 4
.IX Item "-l, --newline"
Een extra regeleinde toevoegen.
.Sp
\&\fBdos2unix\fR: Alleen DOS-regeleindes worden omgezet naar twee
Unix-regeleindes. In Mac-modus worden alleen Mac-regeleindes omgezet naar
twee Unix-regeleindes.
.Sp
\&\fBunix2dos\fR: Alleen Unix-regeleindes worden omgezet naar twee
DOS-regeleindes. In Mac-modus worden Unix-regeleindes omgezet naar twee
Mac-regeleindes.
.IP "\fB\-m\fR, \fB\-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Een Byte-Order-Mark (\s-1BOM\s0) naar het uitvoerbestand schrijven. Standaard
wordt een \s-1UTF\-8\-BOM\s0 geschreven.
.Sp
Als het invoerbestand in \s-1UTF\-16\s0 is, en de optie \f(CW\*(C`\-u\*(C'\fR is gegeven, dan wordt
een \s-1UTF\-16\-BOM\s0 geschreven.
.Sp
Gebruik deze optie nooit als de codering van het uitvoerbestand niet \s-1UTF\-8\s0
of \s-1UTF\-16\s0 is. Zie ook de sectie \s-1UNICODE.\s0
.IP "\fB\-n\fR, \fB\-\-newfile \s-1INVOERBESTAND UITVOERBESTAND\s0\fR ..." 4
.IX Item "-n, --newfile INVOERBESTAND UITVOERBESTAND ..."
Nieuw-bestand-modus. Het bestand \s-1INVOERBESTAND\s0 converteren en naar bestand
\&\s-1UITVOERBESTAND\s0 schrijven. Bestandsnamen moeten opgegeven worden in paren.
Jokertekens moeten \fIniet\fRgebruikt worden, anders \fIverlies\fR je de
bestanden.
.Sp
De gebruiker die de conversie start in nieuw-bestand (gepaarde) modus wordt
de eigenaar van het geconverteerde bestand. De lees/schrijf\-toegangsrechten
van het nieuwe bestand worden de toegangsrechten van het originele bestand
minus de \fIumask\fR\|(1) van de gebruiker die de conversie draait.
.IP "\fB\-o\fR, \fB\-\-oldfile \s-1BESTAND\s0\fR ..." 4
.IX Item "-o, --oldfile BESTAND ..."
Oud-bestand-modus. Het bestand \s-1BESTAND\s0 converteren en overschrijven. Dit
is de standaard modus. Jokertekens kunnen gebruikt worden.
.Sp
In oud-bestand (vervangende) modus krijgt het geconverteerde bestand
dezelfde eigenaar, groep en lees/schrijf\-rechten als het originele bestand.
Ook wanneer het bestand wordt omgezet door een andere gebruiker die
schrijfrechten heeft op het bestand (b.v. gebruiker root). De omzetting
wordt afgebroken wanneer het niet mogelijk is de originele waardes te
behouden. Verandering van eigenaar kan betekenen dat de originele eigenaar
het bestand niet meer kan lezen. Verandering van groep zou een
veiligheidsrisico kunnen zijn, het bestand zou leesbaar kunnen worden voor
personen voor wie het niet bestemd is. Behoud van eigenaar, groep en
lees/schrijf\-rechten wordt alleen ondersteund op Unix.
.IP "\fB\-q\fR, \fB\-\-quiet\fR" 4
.IX Item "-q, --quiet"
Stille werking. Alle waarschuwingen onderdrukken. De aflsuitwaarde is nul,
behalve wanneer verkeerde opties worden gegeven.
.IP "\fB\-r\fR, \fB\-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Een Byte-Order-Mark (\s-1BOM\s0) verwijderen. Er wordt geen \s-1BOM\s0 naar het
uitvoerbestand geschreven. Dit is het standaardgedrag bij conversie naar
Unix. Zie ook optie \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s\fR, \fB\-\-safe\fR" 4
.IX Item "-s, --safe"
Binaire bestanden overslaan (standaard).
.IP "\fB\-u\fR, \fB\-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
De originele UTF\-16\-codering van het invoerbestand behouden. Het
uitvoerbestand wordt in dezelfde UTF\-16\-codering (little endian of big
endian) geschreven als het invoerbestand. Dit voorkomt conversie naar
\&\s-1UTF\-8. \s0 Er wordt ook een corresponderende \s-1UTF\-16\-BOM\s0 geschreven. Deze optie
kan uitgeschakeld worden met de optie \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul\fR, \fB\-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16LE\s0 is.
.Sp
Wanneer het invoerbestand een Byte-Order-Mark (\s-1BOM\s0) bevat, dan gaat deze \s-1BOM\s0
vóór deze optie.
.Sp
Wanneer een verkeerde aanname is gemaakt (het invoerbestand was geen
\&\s-1UTF\-16LE\s0) en de conversie verliep met succes, dan krijgt u een UTF\-8\-bestand
met verkeerde tekst. De verkeerde conversie kan ongedaan worden gemaakt
door met \fIiconv\fR\|(1) het UTF\-8\-uitvoerbestand terug om te zetten naar
\&\s-1UTF\-16LE. \s0 Dit zal het originele bestand terug brengen.
.Sp
De aanname van \s-1UTF\-16LE\s0 werkt als een \fIconversiemodus\fR. Door de
standaardmodus \fIascii\fR in te schakelen wordt de UTF\-16LE\-veronderstelling
uitgeschakeld.
.IP "\fB\-ub\fR, \fB\-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Veronderstellen dat de indeling van het invoerbestand \s-1UTF\-16BE\s0 is.
.Sp
Deze optie werkt hetzelfde als optie \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
.IX Item "-v, --verbose"
Extra meldingen weergeven. Er wordt extra informatie getoond over
Byte-Order-Marks en het aantal geconverteerde regeleindes.
.IP "\fB\-F\fR, \fB\-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Symbolische koppelingen volgen en de doelen converteren.
.IP "\fB\-R\fR, \fB\-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Symbolische koppelingen vervangen door geconverteerde bestanden (de
originele doelbestanden blijven ongewijzigd).
.IP "\fB\-S\fR, \fB\-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Symbolische koppelingen en doelen ongewijzigd laten (standaard).
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
.IX Item "-V, --version"
Versie-informatie tonen.
.SH "MAC-MODUS"
.IX Header "MAC-MODUS"
In normale modus worden DOS-regeleindes naar Unix omgezet en vice versa.
Mac-regeleindes worden niet omgezet.
.PP
In Mac-modus worden Mac-regeleindes naar Unix omgezet en vice versa.
DOS-regeleindes blijven ongewijzigd.
.PP
Om in Mac-modus te draaien kunt u de opdrachtregeloptie \f(CW\*(C`\-c mac\*(C'\fR gebruiken,
of de opdrachten \f(CW\*(C`mac2unix\*(C'\fR of \f(CW\*(C`unix2mac\*(C'\fR.
.SH "CONVERSIEMODI"
.IX Header "CONVERSIEMODI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
In modus \f(CW\*(C`ascii\*(C'\fR worden alleen regeleindes omgezet. Dit is de
standaardmodus.
.Sp
Hoewel de naam van deze modus \s-1ASCII\s0 is, wat een 7\-bits standaard is, is de
werkelijke modus 8\-bits. Gebruik altijd deze modus wanneer u Unicode
UTF\-8\-bestanden omzet.
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Alle 8\-bits niet-ASCII lettertekens (met waardes van 128 t/m 255) worden
omgezet naar een 7\-bits spatie.
.IP "\fBiso\fR" 4
.IX Item "iso"
Tekens worden omgezet tussen een DOS-tekenset (codetabel) en de ISO-tekenset
\&\s-1ISO\-8859\-1 \s0(Latin\-1) op Unix. DOS-tekens zonder een ISO\-8859\-1\-equivalent,
waarvoor dus geen omzetting mogelijk is, worden omgezet in een punt.
Hetzelfde geldt voor ISO\-8859\-1\-tekens zonder DOS-tegenhanger.
.Sp
Wanneer alleen optie \f(CW\*(C`\-iso\*(C'\fR gebruikt wordt, zal dos2unix proberen de
actieve codetabel te gebruiken. Als dat niet mogelijk is wordt codetabel
\&\s-1CP437\s0 gebruikt, die vooral in de \s-1VS\s0 gebruikt wordt. Om een bepaalde
codetabel te forceren, kunt u de opties \f(CW\*(C`\-850\*(C'\fR (West-Europees), \f(CW\*(C`\-860\*(C'\fR
(Portugees), \f(CW\*(C`\-863\*(C'\fR (Canadees Frans) of \f(CW\*(C`\-865\*(C'\fR (Scandinavisch) gebruiken.
Windows-codetabel \s-1CP1252 \s0(West-Europees) wordt ook ondersteund met optie
\&\f(CW\*(C`\-1252\*(C'\fR. Gebruik voor andere codetabellen dos2unix in combinatie met
\&\fIiconv\fR\|(1). Iconv kan omzetten tussen een lange lijst tekensetcoderingen.
.Sp
Gebruik ISO-conversie nooit op Unicode-tekstbestanden. Het zal
UTF\-8\-gecodeerde bestanden beschadigen.
.Sp
Enkele voorbeelden:
.Sp
Omzetten van de standaard DOS-codetabel naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van \s-1DOS CP850\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Windows \s-1CP1252\s0 naar Unix \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar de standaard DOS-codetabel:
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix Latin\-1 naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt uit.txt
.Ve
.Sp
Omzetten van Unix \s-1UTF\-8 \s0(Unicode) naar Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > uit.txt
.Ve
.Sp
Zie ook <http://czyborra.com/charsets/codepages.html> en
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Coderingen"
.IX Subsection "Coderingen"
Er bestaan verschillende Unicode-coderingen. Op Unix en Linux zijn
Unicode-bestanden typisch gecodeerd in \s-1UTF\-8. \s0 Op Windows kunnen
Unicode-tekstbestanden gecodeerd zijn in \s-1UTF\-8, UTF\-16\s0 of \s-1UTF\-16\s0 big endian,
maar ze zijn meestal gecodeerd in \s-1UTF\-16.\s0
.SS "Conversie"
.IX Subsection "Conversie"
Unicode-tekstbestanden kunnen \s-1DOS\-,\s0 Unix\- of Mac-regeleindes hebben, net als
reguliere tekstbestanden.
.PP
Alle versies van dos2unix en unix2dos kunnen UTF\-8\-gecodeerde bestanden
omzetten, want \s-1UTF\-8\s0 is ontworpen op compatibiliteit met \s-1ASCII.\s0
.PP
Dos2unix en unix2dos met Unicode UTF\-16\-ondersteuning kunnen little en big
endian UTF\-16\-gecodeerde tekstbestanden lezen. Om er achter te komen of
dos2unix gebouwd is met \s-1UTF\-16\-\s0 ondersteuning, typt u \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Op Unix/Linux worden UTF\-16\-bestanden geconverteerd naar de codering van de
ingestelde taalregio. Gebruik de opdracht \fBlocale\fR(1) om te zien wat de
ingestelde codering is. Wanneer conversie niet mogelijk is, treedt er een
fout op en wordt het bestand overgeslagen.
.PP
Op Windows worden UTF\-16\-bestanden standaard naar \s-1UTF\-8\s0 geconverteerd.
UTF\-8\-tekstbestanden worden alom goed ondersteund, zowel op Windows als
Unix/Linux.
.PP
De \s-1UTF\-16\-\s0 en UTF\-8\-coderingen zijn volledig compatibel, er gaat bij het
converteren niets verloren. Als er tijdens de conversie van \s-1UTF\-16\s0 naar
\&\s-1UTF\-8\s0 een fout optreedt, bijvoorbeeld omdat het UTF\-16\-invoerbestand een
fout bevat, dan wordt het bestand overgeslagen.
.PP
Wanneer \f(CW\*(C`\-u\*(C'\fR gebruikt wordt, wordt het uitvoerbestand in dezelfde
UTF\-16\-codering geschreven als het invoerbestand. Optie \f(CW\*(C`\-u\*(C'\fR voorkomt
conversie naar \s-1UTF\-8.\s0
.PP
Dos2unix en unix2dos hebben geen optie om van \s-1UTF\-8\s0 naar \s-1UTF\-16\s0 te
converteren.
.PP
\&\s-1ISO\-\s0 en 7\-bits\-conversie werken niet op UTF\-16\-bestanden.
.SS "Byte-Order-Mark"
.IX Subsection "Byte-Order-Mark"
Op Windows bevatten Unicode-tekstbestanden gewoonlijk een Byte-Order-Mark
(\s-1BOM\s0), omdat veel Windows-programma's (inclusief Kladblok) standaard een \s-1BOM\s0
toevoegen. Zie ook <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
Op Unix hebben Unicode-tekstbestanden meestal geen \s-1BOM. \s0 Er wordt aangenomen
dat de codering van tekstbestanden gelijk is aan de tekencodering van de
ingestelde taalregio.
.PP
Dos2unix kan alleen detecteren of een bestand in UTF\-16\-codering is als het
bestand een \s-1BOM\s0 bevat. Wanneer een UTF\-16\-bestand geen \s-1BOM\s0 heeft, ziet
dos2unix het bestand als een binair bestand.
.PP
Gebruik optie \f(CW\*(C`\-ul\*(C'\fR of \f(CW\*(C`\-ub\*(C'\fR om een UTF\-16\-bestand zonder \s-1BOM\s0 om te
zetten.
.PP
Dos2unix schrijft standaard geen \s-1BOM\s0 in het uitvoerbestand. Met optie \f(CW\*(C`\-b\*(C'\fR
schrijft dos2unix een \s-1BOM\s0 wanneer het invoerbestand een \s-1BOM\s0 bevat.
.PP
Unix2dos schrijft standaard een \s-1BOM\s0 in het uitvoerbestand wanneer het
invoerbestand een \s-1BOM\s0 bevat. Gebruik optie \f(CW\*(C`\-r\*(C'\fR om de \s-1BOM\s0 te verwijderen.
.PP
Dos2unix en unix2dos schrijven altijd een \s-1BOM\s0 wanneer optie \f(CW\*(C`\-m\*(C'\fR gebruikt
wordt.
.SS "Unicode-voorbeelden"
.IX Subsection "Unicode-voorbeelden"
Omzetten van Windows \s-1UTF\-16 \s0(met \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt uit.txt
.Ve
.PP
Omzetten van Windows \s-1UTF\-16LE \s0(zonder \s-1BOM\s0) naar Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-8\s0 met \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt uit.txt
.Ve
.PP
Omzetten van Unix \s-1UTF\-8\s0 naar Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > uit.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 is een standaard van de Chinese overheid. Een subset van de
GB18030\-standaard is officieel verplicht voor alle softwareproducten die in
China verkocht worden. Zie ook <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 is volledig compatibel met Unicode, en kan als een
Unicodetransformatie beschouwd worden. Net als \s-1UTF\-8\s0 is \s-1GB18030\s0 compatibel
met \s-1ASCII. GB18030\s0 is ook compatibel met Windows-codetabel 936 (ook wel \s-1GBK\s0
genoemd).
.PP
Op Unix/Linux worden UTF\-16\-bestanden alleen naar \s-1GB18030\s0 geconverteerd
wanneer de taalregio op China ingesteld is en de codering op \s-1GB18030.\s0
Bijvoorbeeld, met de Britse taalregio-instelling \f(CW\*(C`en_GB.GB18030\*(C'\fR zal
conversie van \s-1UTF\-16\s0 naar \s-1GB18030\s0 niet werken, maar met de Chinese
instelling \f(CW\*(C`zh_CN.GB18030\*(C'\fR wel.
.PP
Op Windows dient u de optie \f(CW\*(C`\-gb\*(C'\fR te gebruiken om UTF\-16\-bestanden naar
\&\s-1GB18030\s0 te converteren.
.PP
GB18030\-bestanden kunnen een Byte-Order-Mark bevatten, net als
Unicode-bestanden.
.SH "VOORBEELDEN"
.IX Header "VOORBEELDEN"
Invoer lezen van standaardinvoer en uitvoer schrijven naar standaarduitvoer:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten en vervangen van b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Omzetten en vervangen van a.txt in ascii-conversiemodus; omzetten en
vervangen van b.txt in 7\-bits conversiemodus:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Omzetten van a.txt van Mac\- naar Unix-indeling:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Omzetten van a.txt van Unix\- naar Mac-indeling:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Omzetten en vervangen van a.txt met behoud van origineel tijdsstempel:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Omzetten van a.txt en resultaat naar e.txt schrijven:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Omzetten van a.txt en naar e.txt schrijven, met tijdsstempel van e.txt
gelijk aan die van a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Omzetten en vervangen van a.txt; omzetten van b.txt en naar e.txt schrijven:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Omzetten van c.txt en naar e.txt schrijven; omzetten en vervangen van a.txt;
omzetten en vervangen van b.txt; omzetten van d.txt en naar f.txt schrijven.
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "RECURSIEVE CONVERSIE"
.IX Header "RECURSIEVE CONVERSIE"
Gebruik dos2unix in combinatie met de opdrachten \fBfind\fR(1) en \fBxargs\fR(1)
om tekstbestanden in een mappenboom recursief om te zetten. Bijvoorbeeld om
alle .txt\-bestanden in de mappenboom onder de huidige map te converteren,
typt u:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALISATIE"
.IX Header "LOKALISATIE"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
De primaire taal wordt geselecteerd via de omgevingsvariabele \s-1LANG. \s0 De
variabele \s-1LANG\s0 bestaat uit verschillende onderdelen. Het eerste deel is in
kleine letters de taalcode. Het tweede deel is optioneel en is de landcode
in hoofdletters, voorafgegaan door een liggend streepje. Er is ook een
optioneel derde deel: de tekencodering, voorafgegaan door een punt. Enkele
voorbeelden voor een POSIX-shell:
.Sp
.Vb 7
\& export LANG=nl Nederlands
\& export LANG=nl_NL Nederlands, Nederland
\& export LANG=nl_BE Nederlands, België
\& export LANG=es_ES Spaans, Spanje
\& export LANG=es_MX Spaans, Mexico
\& export LANG=en_US.iso88591 Engels, VS, Latin\-1\-codering
\& export LANG=en_GB.UTF\-8 Engels, GB, UTF\-8\-codering
.Ve
.Sp
Voor een complete lijst van taal\- en landcodes zie de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Op Unix-systemen kunt u de opdracht \fBlocale\fR(1) gebruiken om specifieke
taalregio-informatie te verkrijgen.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Met de omgevingsvariabele \s-1LANGUAGE\s0 kunt u een prioriteitenlijst specificeren
van talen, gescheiden door dubbele punten. Dos2unix geeft voorrang aan
\&\s-1LANGUAGE\s0 boven \s-1LANG. \s0 Bijvoorbeeld, eerst Nederlands en dan Duits:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. U moet eerst lokalisatie in werking stellen, door het
instellen van \s-1LANG \s0(of \s-1LC_ALL\s0) op een waarde ongelijk aan \*(L"C\*(R", voordat u een
talen-prioriteitenlijst kunt gebruiken via de variabele \s-1LANGUAGE. \s0 Zie ook
de gettext-handleiding:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Als u een taal kiest die niet beschikbaar is, worden de standaard Engelse
berichten gebruikt.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Met de omgevingsvariabele \s-1DOS2UNIX_LOCALEDIR\s0 kan de \s-1LOCALEDIR\s0 die ingesteld
werd tijdens compilatie worden overstemd. \s-1LOCALEDIR\s0 wordt gebruikt om de
taalbestanden te vinden. De \s-1GNU\s0 standaardwaarde is
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. De optie \fB\-\-version\fR laat de gebruikte
\&\s-1LOCALEDIR\s0 zien.
.Sp
Voorbeeld (POSIX-shell):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "AFSLUITWAARDE"
.IX Header "AFSLUITWAARDE"
Bij succes wordt nul teruggegeven. Wanneer een systeemfout optreedt wordt
het laatste systeemfoutnummer teruggegeven. Bij andere fouten wordt 1
teruggegeven.
.PP
De afsluitwaarde is altijd nul in de stillewerkingsmodus, behalve wanneer
verkeerde opties worden gegeven.
.SH "STANDAARDEN"
.IX Header "STANDAARDEN"
<http://nl.wikipedia.org/wiki/Tekstbestand>
.PP
<http://nl.wikipedia.org/wiki/Carriage_Return>
.PP
<http://nl.wikipedia.org/wiki/Linefeed>
.PP
<http://nl.wikipedia.org/wiki/Unicode>
.SH "AUTEURS"
.IX Header "AUTEURS"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben
(mac2unix\-modus) \- <wuebben@kde.org>, Christian Wurll (toevoegen van extra
regeleindes) \- <wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl>
(beheerder)
.PP
Projectpagina: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
SourceForge-pagina: <http://sourceforge.net/projects/dos2unix/>
.SH "ZIE OOK"
.IX Header "ZIE OOK"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,756 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAZWA"
.IX Header "NAZWA"
dos2unix \- konwerter formatu plików tekstowych między systemami DOS/Mac a
Uniksem
.SH "SKŁADNIA"
.IX Header "SKŁADNIA"
.Vb 2
\& dos2unix [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
\& unix2dos [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
.Ve
.SH "OPIS"
.IX Header "OPIS"
Pakiet Dos2unix zawiera narzędzia \f(CW\*(C`dos2unix\*(C'\fR oraz \f(CW\*(C`unix2dos\*(C'\fR do konwersji
zwykłych plików tekstowych między formatami używanymi w systemach \s-1DOS\s0 lub
Mac a formatem uniksowym.
.PP
W plikach tekstowych systemu DOS/Windows oznaczenie końca linii to
połączenie dwóch znaków: powrotu karetki (\s-1CR\s0) i przesunięcia linii (\s-1LF\s0). W
uniksowych plikach tekstowych koniec linii to pojedynczy znak \s-1LF. W\s0 plikach
tekstowych systemu Mac sprzed Mac \s-1OS X\s0 koniec linii był pojedynczym znakiem
\&\s-1CR.\s0 Obecnie Mac \s-1OS\s0 wykorzystuje uniksowe końce linii (\s-1LF\s0).
.PP
Oprócz oznaczeń końców linii Dos2unix potrafi konwertować także kodowanie
plików. Kilko stron kodowych DOS-a może być przekonwertowanych do uniksowego
Latin\-1, a windowsowy Unicode (\s-1UTF\-16\s0) do powszechniejszego pod Uniksem
kodowania Unicode \s-1UTF\-8.\s0
.PP
Pliki binarne są pomijane automatycznie, chyba że konwersja zostanie
wymuszona.
.PP
Pliki inne niż zwykłe, np. katalogi lub \s-1FIFO,\s0 są pomijane automatycznie.
.PP
Dowiązania symboliczne i ich cele są domyślnie pozostawiane bez
zmian. Dowiązania symboliczne mogą być opcjonalnie zastępowane, albo wyjście
może być zapisywane do celu dowiązania. Zapis do celu dowiązania
symbolicznego nie jest obsługiwane pod Windows.
.PP
Dos2unix powstał na podstawie narzędzia dos2unix z systemu
SunOS/Solaris. Jest jedna istotna różnica w stosunku do oryginalnej wersji z
SunOS\-a/Solarisa: ta wersja domyślnie wykonuje konwersję w miejscu (tryb
starego pliku), podczas gdy oryginalna obsługiwała tylko konwersję parami
(tryb nowego pliku) \- p. także opcje \f(CW\*(C`\-o\*(C'\fR i \f(CW\*(C`\-n\*(C'\fR.
.SH "OPCJE"
.IX Header "OPCJE"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Potraktowanie wszystkich kolejnych opcji jako nazw plików. Tej opcji należy
użyć, aby przekonwertować pliki, których nazwy zaczynają się od
minusa. Przykładowo, aby przekonwertować plik o nazwie \*(L"\-foo\*(R", można użyć
polecenia:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Lub w trybie nowego pliku:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Konwersja tylko znaków końca linii. Jest to domyślny tryb konwersji.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Konwersja między zestawami znaków \s-1DOS\s0 i \s-1ISO\-8859\-1.\s0 Więcej w sekcji \s-1TRYBY
KONWERSJI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Użycie strony kodowej Windows 1252 (zachodnioeuropejskiej).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Użycie strony kodowej \s-1DOS 437 \s0(\s-1US\s0). Jest to domyślna strona kodowa używana
przy konwersji \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Użycie strony kodowej \s-1DOS 850 \s0(zachodnioeuropejskiej).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Użycie strony kodowej \s-1DOS 860 \s0(portugalskiej).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Użycie strony kodowej \s-1DOS 863 \s0(kanadyjskiej francuskiej).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Użycie strony kodowej \s-1DOS 865 \s0(nordyckiej).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Konwersja znaków 8\-bitowych do przestrzeni 7\-bitowej.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Zachowanie znaku \s-1BOM \s0(Byte Order Makr). Jeżeli plik wejściowy zawiera \s-1BOM,\s0
powoduje zapisanie go w pliku wyjściowym. Jest to domyślne zachowanie przy
konwersji na DOS-owe końce linii. P. także opcja \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1TRYB_KONW\s0\fR" 4
.IX Item "-c, --convmode TRYB_KONW"
Ustawienie trybu konwersji. \s-1TRYB_KONW\s0 to jeden z: \fIascii\fR, \fI7bit\fR, \fIiso\fR,
\&\fImac\fR, przy czym domyślny jest ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Wymuszenie konwersji plików binarnych.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Pod Windows pliki w \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8,\s0 niezależnie
od ustawienia lokalizacji. Ta opcja pozwala przekonwertować pliki w \s-1UTF\-16\s0
do \s-1GB18030.\s0 Opcja jest dostępna tylko pod Windows, więcej w sekcji
dotyczącej \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Wyświetlenie opisu i zakończenie.
.IP "\fB\-i[\s-1FLAGI\s0], \-\-info[=FLAGI] \s-1PLIK ...\s0\fR" 4
.IX Item "-i[FLAGI], --info[=FLAGI] PLIK ..."
Wyświetlenie informacji o pliku. Konwersja nie jest wykonywana.
.Sp
Wypisywane są następujące informacje, w tej kolejności: liczba DOS-owych
końców linii, liczba uniksowych końców linii, liczba macowych końców linii,
znacznik \s-1BOM,\s0 tekstowy lub binarny, nazwa pliku.
.Sp
Przykładowe wyjście:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcjonalnie można ustawić dodatkowe flagi, aby zmienić wyjście. Można dodać
jedną lub więcej flag.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Wypisanie liczby DOS-owych końców linii.
.IP "\fBu\fR" 4
.IX Item "u"
Wypisanie liczby uniksowych końców linii.
.IP "\fBm\fR" 4
.IX Item "m"
Wypisanie liczby macowych końców linii.
.IP "\fBb\fR" 4
.IX Item "b"
Wypisanie znacznika \s-1BOM.\s0
.IP "\fBt\fR" 4
.IX Item "t"
Wypisanie, czy plik jest tekstowy, czy binarny.
.IP "\fBc\fR" 4
.IX Item "c"
Wypisanie tylko plików, które zostałyby przekonwertowane.
.Sp
Z flagą \f(CW\*(C`c\*(C'\fR dos2unix wypisze tylko pliki zawierające DOS-owe końce linii, a
unix2dos wypisze tylko nazwy plików zawierających uniksowe końce linii.
.RE
.RS 4
.Sp
Przykłady:
.Sp
Pokazanie informacji o wszystkich plikach *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Pokazanie tylko liczby DOS-owych i uniksowych końców linii:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Pokazanie tylko znacznika \s-1BOM:\s0
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Wypisanie listy plików zawierających DOS-owe końce linii:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Wypisanie listy plików zawierających uniksowe końce linii:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Zachowanie znacznika czasu pliku wyjściowego takiego samego, jak pliku
wejściowego.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Wyświetlenie licencji programu.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Dodanie dodatkowego znaku końca linii.
.Sp
\&\fBdos2unix\fR: tylko DOS-owe znaki końca linii są zamieniane na dwa
uniksowe. W trybie Mac tylko macowe znaki końca linii są zamieniane na dwa
uniksowe.
.Sp
\&\fBunix2dos\fR: tylko uniksowe znaki końca linii są zamieniane na dwa
DOS-owe. W trybie Mac uniksowe znaki końca linii są zamieniane na dwa
macowe.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Zapisanie znacznika \s-1BOM \s0(Byte Order Mark) w pliku wyjściowym. Domyślnie
zapisywany jest \s-1BOM UTF\-8.\s0
.Sp
Jeśli plik wejściowy jest w kodowaniu \s-1UTF\-16\s0 i użyto opcji \f(CW\*(C`\-u\*(C'\fR, zostanie
zapisany \s-1BOM UTF\-16.\s0
.Sp
Nigdy nie należy używać tej opcji, jeśli kodowanie wyjściowe jest inne niż
\&\s-1UTF\-8\s0 lub \s-1UTF\-16.\s0 Więcej w sekcji \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1PLIK_WEJ PLIK_WYJ ...\s0\fR" 4
.IX Item "-n, --newfile PLIK_WEJ PLIK_WYJ ..."
Tryb nowego pliku. Konwersja \s-1PLIKU_WEJ\s0 z zapisem wyjścia do \s-1PLIKU_WYJ.\s0 Nazwy
plików muszą być podane parami, a masek \fInie\fR należy używać, gdyż
\&\fIspowoduje\fR to utratę plików.
.Sp
Osoba uruchamiająca konwersję w trybie nowego pliku (par) będzie
właścicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego pliku
będą pochodziły z praw pliku oryginalnego po odjęciu \fIumask\fR\|(1) osoby
uruchamiającej konwersję.
.IP "\fB\-o, \-\-oldfile \s-1PLIK ...\s0\fR" 4
.IX Item "-o, --oldfile PLIK ..."
Tryb starego pliku. Konwersja \s-1PLIKU\s0 i nadpisanie go wyjściem. Program działa
domyślnie w tym trybie. Można używać masek.
.Sp
W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje tego
samego właściciela, grupę oraz prawa odczytu/zapisu, jak plik oryginalny \-
także wtedy, gdy plik jest konwertowany przez innego użytkownika, mającego
prawo zapisu do pliku (np. przez użytkownika root). Konwersja zostanie
przerwana, jeśli nie będzie możliwe zachowanie oryginalnych wartości. Zmiana
właściciela mogłaby oznaczać, że pierwotny właściciel nie może już odczytać
pliku. Zmiana grupy mogłaby być zagrożeniem bezpieczeństwa, plik mógłby być
czytelny dla nie zamierzonych osób. Zachowanie właściciela, grupy i praw
odczytu/zapisu jest obsługiwane tylko na Uniksie.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Tryb cichy. Pominięcie wszystkich ostrzeżeń i komunikatów. Zwracanym kodem
jest zero, chyba że podano błędne opcje linii poleceń.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Usunięcie znaków \s-1BOM \s0(Byte Order Mark). Bez zapisywania \s-1BOM\s0 do pliku
wyjściowego. Jest to domyślne zachowanie przy konwersji na uniksowe końce
linii. P. także opcja \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Pominięcie plików binarnych (domyślne).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Zachowanie oryginalnego kodowania pliku wejściowego \s-1UTF\-16.\s0 Plik wyjściowy
zostanie zapisany w tym samym kodowaniu \s-1UTF\-16 \s0(little lub big endian), co
plik wejściowy. Zapobiega to przekształceniu do \s-1UTF\-8.\s0 Do pliku zostanie
zapisany odpowiedni znacznik \s-1BOM UTF\-16.\s0 Tę opcję można wyłączyć opcją
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16LE.\s0
.Sp
Jeśli w pliku wejściowym jest znacznik \s-1BOM \s0(Byte Order Mark), ma on
priorytet nad tą opcją.
.Sp
Jeśli przyjęto błędne założenie (plik wejściowy nie jest w formacie
\&\s-1UTF\-16LE\s0), a konwersja się uda, wynikiem będzie plik wyjściowy \s-1UTF\-8\s0 ze złym
tekstem. Konwersję tę można odwrócić przy użyciu polecenia \fIiconv\fR\|(1) do
konwersji wyjścia \s-1UTF\-8\s0 z powrotem do \s-1UTF\-16LE.\s0 Przywróci to plik
oryginalny.
.Sp
Przyjęcie \s-1UTF\-16LE\s0 działa jako \fItryb konwersji\fR. Przy przełączeniu na
domyślny tryb \fIascii\fR przyjęcie \s-1UTF\-16LE\s0 jest wyłączane.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16BE.\s0
.Sp
Ta opcja działa analogicznie do \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Wyświetlanie szczegółowych komunikatów. Wyświetlane śa dodatkowe informacje
o znacznikach \s-1BOM \s0(Byte Order Mark) oraz liczbie przekonwertowanych końców
linii.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Podążanie za dowiązaniami symbolicznymi i konwertowanie ich celów
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Zastępowanie dowiązań symbolicznych przekonwertowanymi plikami (oryginalne
pliki docelowe pozostają bez zmian).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Pozostawienie dowiązań symbolicznych i celów bez zmian (domyślne).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Wyświetlenie informacji o wersji i zakończenie.
.SH "TRYB MAC"
.IX Header "TRYB MAC"
W zwykłym trybie znaki końca linii są konwertowane z DOS-a do Uniksa i
odwrotnie. Znaki końca linii systemu Mac nie są konwertowane.
.PP
W trybie Mac znaki końca linii są konwertowane z formatu Maca do Uniksa i
odwrotnie. Znaki końca linii systemu \s-1DOS\s0 nie są zmieniane.
.PP
Aby uruchomić program w trybie Mac, należy użyć opcji linii poleceń \f(CW\*(C`\-c
mac\*(C'\fR albo użyć poleceń \f(CW\*(C`mac2unix\*(C'\fR lub \f(CW\*(C`unix2mac\*(C'\fR.
.SH "TRYBY KONWERSJI"
.IX Header "TRYBY KONWERSJI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
W trybie \f(CW\*(C`ascii\*(C'\fR konwertowane są tylko końce linii. Jest to domyślny tryb
konwersji.
.Sp
Mimo że nazwa tego trybu to \s-1ASCII,\s0 które jest standardem 7\-bitowym, jest to
tryb 8\-bitowy. Należy zawsze używać tego trybu przy konwersji plików Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
W tym trybie wszystkie znaki 8\-bitowe spoza \s-1ASCII \s0(o wartościach od 128 do
255) są konwertowane do przestrzeni 7\-bitowej.
.IP "\fBiso\fR" 4
.IX Item "iso"
W tym trybie znaki są konwertowane między zestawem znaków \s-1DOS \s0(stroną
kodową) a zestawem znaków \s-1ISO\-8859\-1 \s0(Latin\-1) używanym na Uniksie. Znaki
DOS-owe nie mające odpowiednika w \s-1ISO\-8859\-1,\s0 których nie da się
przekonwertować, są zamieniane na kropkę. To samo dotyczy znaków \s-1ISO\-8859\-1\s0
bez odpowiednika w DOS-ie.
.Sp
Jeśli używana jest tylko opcja \f(CW\*(C`\-iso\*(C'\fR, dos2unix próbuje wykryć aktywną
stronę kodową. Jeśli nie jest to możliwe, dos2unix używa domyślnej strony
kodowej \s-1CP437,\s0 stosowanej głównie w \s-1USA.\s0 Aby wymusić określoną stronę
kodową, należy użyć opcji \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (zachodnioeuropejska),
\&\f(CW\*(C`\-860\*(C'\fR (portugalska), \f(CW\*(C`\-863\*(C'\fR (kanadyjska francuska) lub \f(CW\*(C`\-865\*(C'\fR
(nordycka). Ponadto obsługiwana jest strona kodowa Windows \s-1CP1252
\&\s0(zachodnioeuropejska) przy użyciu opcji \f(CW\*(C`\-1252\*(C'\fR. W przypadku innych stron
kodowych można użyć narzędzia dos2unix wraz z \fIiconv\fR\|(1). Iconv potrafi
konwertować między wieloma kodowaniami znaków.
.Sp
Nigdy nie należy używać konwersji \s-1ISO\s0 na plikach tekstowych w
Unicode. Uszkodziłaby pliki kodowane \s-1UTF\-8.\s0
.Sp
Kilka przykładów:
.Sp
Konwersja z domyślnej strony kodowej \s-1DOS\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej \s-1DOS CP850\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Konwersa z uniksowego Latin\-1 do domyślnej strony kodowej \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego \s-1UTF\-8 \s0(Unicode) do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Więcej pod adresem <http://czyborra.com/charsets/codepages.html> oraz
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Kodowania"
.IX Subsection "Kodowania"
Istnieją różne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode są
zwykle kodowane z użyciem \s-1UTF\-8.\s0 Pod Windows pliki tekstowe Unicode mogą być
kodowane w \s-1UTF\-8, UTF\-16, UTF\-16\s0 big-endian, ale przeważnie są kodowane w
\&\s-1UTF\-16.\s0
.SS "Konwersje"
.IX Subsection "Konwersje"
Pliki tekstowe Unicode mogą mieć znaki końca linii systemu \s-1DOS,\s0 Unix lub
Mac, podobnie jak zwykłe pliki tekstowe.
.PP
Wszystkie wersje dos2unix i unix2dos potrafią konwertować pliki kodowane
\&\s-1UTF\-8,\s0 ponieważ \s-1UTF\-8\s0 jest wstecznie zgodne z \s-1ASCII.\s0
.PP
Dos2unix i unix2dos z obsługą Unicode \s-1UTF\-16\s0 potrafią odczytywać pliki
tekstowe kodowane \s-1UTF\-16\s0 little\- oraz big-endian. Aby sprawdzić, czy
dos2unix został zbudowany z obsługą \s-1UTF\-16,\s0 należy napisać \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Pod Uniksem/Linuksem pliki w kodowaniu \s-1UTF\-16\s0 są konwertowane do kodowania
znaków ustawionej lokalizacji. Kodowanie znaków dla lokalizacji można
sprawdzić poleceniem \fIlocale\fR\|(1). Jeśli konwersja nie jest możliwa, wystąpi
błąd, a plik zostanie pominięty.
.PP
Pod Windows pliki \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8.\s0 Pliki tekstkowe
w kodowaniu \s-1UTF\-8\s0 są dobrze obsługiwane zarówno pod Windows, jak i
Uniksem/Linuksem.
.PP
Kodowania \s-1UTF\-16\s0 i \s-1UTF\-8\s0 są w pełni zgodne, konwersja nie spowoduje utraty
żadnej części tekstu. W przypadku wystąpienia błędu konwersji, na przykład w
przypadku błędu w pliku wejściowym \s-1UTF\-16,\s0 plik zostanie pominięty.
.PP
W przypadku użycia opcji \f(CW\*(C`\-u\*(C'\fR, plik wejściowy zostanie zapisany w tym samym
kodowaniu \s-1UTF\-16,\s0 co plik wejściowy. Opcja \f(CW\*(C`\-u\*(C'\fR zapobiega konwersji do
\&\s-1UTF\-8.\s0
.PP
Dos2unix oraz unix2dos nie mają opcji pozwalającej na konwersję plików \s-1UTF\-8\s0
do \s-1UTF\-16.\s0
.PP
Tryby konwersji \s-1ISO\s0 i 7\-bit nie działają na plikach \s-1UTF\-16.\s0
.SS "Znacznik \s-1BOM\s0"
.IX Subsection "Znacznik BOM"
W systemie Windows pliki tekstowe zwykle zawierają znacznik \s-1BOM \s0(Byte Order
Mark), ponieważ wiele programów dla Windows (w tym Notepad) dodaje domyślnie
znaczniki \s-1BOM.\s0 Więcej informacji można znaleźć pod adresem
<http://pl.wikipedia.org/wiki/BOM_(informatyka)>.
.PP
Pod Uniksem pliki Unicode zwykle nie mają znacznika \s-1BOM.\s0 Pliki tekstowe są
traktowane jako kodowane zgodnie z kodowaniem znaków ustawionej lokalizacji.
.PP
Dos2unix potrafi wykryć tylko, czy plik jest w formacie \s-1UTF\-16,\s0 jeśli
zawiera znacznik \s-1BOM.\s0 Jeśli plik \s-1UTF\-16\s0 nie ma tego znacznika, dos2unix
potraktuje plik jako binarny.
.PP
Do konwersji pliku \s-1UTF\-16\s0 bez znacznika \s-1BOM\s0 można użyć opcji \f(CW\*(C`\-ul\*(C'\fR lub
\&\f(CW\*(C`\-ub\*(C'\fR.
.PP
Dos2unix nie zapisuje domyślnie znaku \s-1BOM\s0 w pliku wyjściowym. Z opcją \f(CW\*(C`\-b\*(C'\fR
Dos2unix zapisuje \s-1BOM,\s0 jeśli plik wejściowy zawiera \s-1BOM.\s0
.PP
Unix2dos domyślnie zapisuje znaczniki \s-1BOM\s0 w pliku wyjściowym, jeśli plik
wejściowy ma \s-1BOM.\s0 Aby usunąć \s-1BOM,\s0 można użyć opcji \f(CW\*(C`\-r\*(C'\fR.
.PP
Dos2unix oraz unix2dos zawsze zapisują znaczniki \s-1BOM,\s0 jeśli użyta zostanie
opcja \f(CW\*(C`\-m\*(C'\fR.
.SS "Przykłady Unicode"
.IX Subsection "Przykłady Unicode"
Konwersja pliku \s-1UTF\-16 \s0(z \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Konwersja pliku \s-1UTF\-16LE \s0(bez \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-8\s0 z \s-1BOM\s0 dla Windows:
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-16\s0 dla Windows:
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 to standard urzędowy w Chinach. Obowiązkowy podzbiór standardu
\&\s-1GB18030\s0 jest oficjalnym wymaganiem każdego oprogramowania sprzedawanego w
Chinach. Więcej pod adresem <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 jest w pełni zgodny z Unicode i może być uważany za format
transformacji unikodu. Podobnie jak \s-1UTF\-8, GB18030\s0 jest zgodny z \s-1ASCII.\s0 Jest
także zgodny ze stroną kodową Windows 936, znaną też jako \s-1GBK.\s0
.PP
Pod Uniksem/Linuksem pliki \s-1UTF\-16\s0 są konwertowane do \s-1GB18030,\s0 jeśli
kodowanie dla lokalizacji jest ustawione na \s-1GB18030.\s0 Uwaga: będzie to
działać tylko dla lokalizacji chińskiej. W przypadku np. ustawienia
lokalizacji angielskiej/brytyjskiej \f(CW\*(C`en_GB.GB18030\*(C'\fR konwersja \s-1UTF\-16\s0 do
\&\s-1GB18030\s0 nie będzie działać, a dla lokalizacji chińskiej \f(CW\*(C`zh_CN.GB18030\*(C'\fR
będzie.
.PP
Pod Windows w celu konwersji plików \s-1UTF\-16\s0 do \s-1GB18030\s0 należy użyć opcji
\&\f(CW\*(C`\-gb\*(C'\fR.
.PP
Pliki w kodowaniu \s-1GB18030\s0 mogą mieć znacznik \s-1BOM,\s0 podobnie jak pliki w
Unicode.
.SH "PRZYKŁADY"
.IX Header "PRZYKŁADY"
Odczyt ze standardowego wejścia i zapis na standardowe wyjście:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja i zastąpienie b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii; konwersja i zastąpienie b.txt
w trybie 7\-bitowym:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Konwersja a.txt z formatu Mac do formatu uniksowego:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Konwersja a.txt z formatu uniksowego do formatu Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt z zachowaniem oryginalnego znacznika czasu:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt
takiego, jak a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja b.txt i zapis do e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Konwersja c.txt i zapis do e.txt; konwersja i zastąpienie a.txt; konwersja i
zastąpienie b.txt; konwersja d.txt i zapis do f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "KONWERSJA REKURENCYJNA"
.IX Header "KONWERSJA REKURENCYJNA"
Można użyć dos2unix w połączeniu z poleceniami \fIfind\fR\|(1) i \fIxargs\fR\|(1) do
rekurencyjnej konwersji plików tekstowych w strukturze drzewa katalogów. Na
przykład, aby przekonwertować wszystkie pliki .txt w drzewie katalogów
poniżej katalogu bieżącego, należy napisać:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALIZACJA"
.IX Header "LOKALIZACJA"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Główny język wybiera się zmienną środowiskową \s-1LANG.\s0 Zmienna \s-1LANG\s0 składa się
z kilku części. Pierwsza część to małe litery oznaczające kod języka. Druga
część jest opcjonalna i zawiera kod kraju pisany wielkimi literami,
poprzedzony podkreśleniem. Jest także opcjonalna trzecia część: kodowanie
znaków, poprzedzone kropką. Kilka przykładów dla powłok zgodnych ze
standardem \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl holenderski
\& export LANG=nl_NL holenderski, Holandia
\& export LANG=nl_BE holenderski, Belgia
\& export LANG=es_ES hiszpański, Hiszpania
\& export LANG=es_MX hiszpański, Meksyk
\& export LANG=en_US.iso88591 angielski, USA, kodowanie Latin\-1
\& export LANG=en_GB.UTF\-8 angielski, Wlk. Brytania, kodowanie UTF\-8
.Ve
.Sp
Pełną listę kodów języków i krajów można znaleźć w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
W systemach uniksowych do uzyskania informacji dotyczących lokalizacji można
użyć polecenia \fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Przy użyciu zmiennej środowiskowej \s-1LANGUAGE\s0 można określić listę języków wg
priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje pierwszeństwo
zmiennej \s-1LANGUAGE\s0 nad \s-1LANG.\s0 Na przykład, najpierw holenderski, następnie
niemiecki: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Aby skorzystać z listy wg priorytetów ze
zmiennej \s-1LANGUAGE,\s0 trzeba najpierw włączyć lokalizację przez ustawienie
zmiennej \s-1LANG \s0(lub \s-1LC_ALL\s0) na wartość inną niż \*(L"C\*(R". Więcej informacji
znajduje się w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
W przypadku wybrania niedostępnego języka, otrzymamy standardowe, angielskie
komunikaty.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Przy użyciu zmiennej środowiskowej \s-1DOS2UNIX_LOCALEDIR,\s0 można nadpisać
ustawienie \s-1LOCALEDIR\s0 z czasu kompilacji. \s-1LOCALEDIR\s0 to katalog używany do
znalezienia plików lokalizacji. Domyślną wartością dla \s-1GNU\s0 jest
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Opcja \fB\-\-version\fR wyświetla używaną wartość
\&\s-1LOCALEDIR.\s0
.Sp
Przykład (dla powłoki \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "WARTOŚĆ ZWRACANA"
.IX Header "WARTOŚĆ ZWRACANA"
W przypadku powodzenia zwracane jest zero. Jeśli wystąpi błąd systemowy,
zwracany jest ostatni błąd systemowy. W przypadku innych błędów zwracane
jest 1.
.PP
Wartość zwracana w trybie cichym to zawsze zero, z wyjątkiem sytuacji
podania błędnych opcji linii poleceń.
.SH "STANDARDY"
.IX Header "STANDARDY"
<http://pl.wikipedia.org/wiki/Plik_tekstowy>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://pl.wikipedia.org/wiki/End\-of\-line>
.PP
<http://pl.wikipedia.org/wiki/Unicode>
.SH "AUTORZY"
.IX Header "AUTORZY"
Benjamin Lin <blin@socs.uts.edu.au>; Bernd Johannes Wuebben (tryb mac2unix)
<wuebben@kde.org>; Christian Wurll (dodawanie dodatkowej nowej linii)
<wurll@ira.uka.de>; Erwin Waterlander <waterlan@xs4all.nl> (prowadzący)
.PP
Strona projektu: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Strona SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ZOBACZ TAKŻE"
.IX Header "ZOBACZ TAKŻE"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,756 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAZWA"
.IX Header "NAZWA"
dos2unix \- konwerter formatu plików tekstowych między systemami DOS/Mac a
Uniksem
.SH "SKŁADNIA"
.IX Header "SKŁADNIA"
.Vb 2
\& dos2unix [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
\& unix2dos [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
.Ve
.SH "OPIS"
.IX Header "OPIS"
Pakiet Dos2unix zawiera narzędzia \f(CW\*(C`dos2unix\*(C'\fR oraz \f(CW\*(C`unix2dos\*(C'\fR do konwersji
zwykłych plików tekstowych między formatami używanymi w systemach \s-1DOS\s0 lub
Mac a formatem uniksowym.
.PP
W plikach tekstowych systemu DOS/Windows oznaczenie końca linii to
połączenie dwóch znaków: powrotu karetki (\s-1CR\s0) i przesunięcia linii (\s-1LF\s0). W
uniksowych plikach tekstowych koniec linii to pojedynczy znak \s-1LF. W\s0 plikach
tekstowych systemu Mac sprzed Mac \s-1OS X\s0 koniec linii był pojedynczym znakiem
\&\s-1CR.\s0 Obecnie Mac \s-1OS\s0 wykorzystuje uniksowe końce linii (\s-1LF\s0).
.PP
Oprócz oznaczeń końców linii Dos2unix potrafi konwertować także kodowanie
plików. Kilko stron kodowych DOS-a może być przekonwertowanych do uniksowego
Latin\-1, a windowsowy Unicode (\s-1UTF\-16\s0) do powszechniejszego pod Uniksem
kodowania Unicode \s-1UTF\-8.\s0
.PP
Pliki binarne są pomijane automatycznie, chyba że konwersja zostanie
wymuszona.
.PP
Pliki inne niż zwykłe, np. katalogi lub \s-1FIFO,\s0 są pomijane automatycznie.
.PP
Dowiązania symboliczne i ich cele są domyślnie pozostawiane bez
zmian. Dowiązania symboliczne mogą być opcjonalnie zastępowane, albo wyjście
może być zapisywane do celu dowiązania. Zapis do celu dowiązania
symbolicznego nie jest obsługiwane pod Windows.
.PP
Dos2unix powstał na podstawie narzędzia dos2unix z systemu
SunOS/Solaris. Jest jedna istotna różnica w stosunku do oryginalnej wersji z
SunOS\-a/Solarisa: ta wersja domyślnie wykonuje konwersję w miejscu (tryb
starego pliku), podczas gdy oryginalna obsługiwała tylko konwersję parami
(tryb nowego pliku) \- p. także opcje \f(CW\*(C`\-o\*(C'\fR i \f(CW\*(C`\-n\*(C'\fR.
.SH "OPCJE"
.IX Header "OPCJE"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Potraktowanie wszystkich kolejnych opcji jako nazw plików. Tej opcji należy
użyć, aby przekonwertować pliki, których nazwy zaczynają się od
minusa. Przykładowo, aby przekonwertować plik o nazwie \*(L"\-foo\*(R", można użyć
polecenia:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Lub w trybie nowego pliku:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Konwersja tylko znaków końca linii. Jest to domyślny tryb konwersji.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Konwersja między zestawami znaków \s-1DOS\s0 i \s-1ISO\-8859\-1.\s0 Więcej w sekcji \s-1TRYBY
KONWERSJI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Użycie strony kodowej Windows 1252 (zachodnioeuropejskiej).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Użycie strony kodowej \s-1DOS 437 \s0(\s-1US\s0). Jest to domyślna strona kodowa używana
przy konwersji \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Użycie strony kodowej \s-1DOS 850 \s0(zachodnioeuropejskiej).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Użycie strony kodowej \s-1DOS 860 \s0(portugalskiej).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Użycie strony kodowej \s-1DOS 863 \s0(kanadyjskiej francuskiej).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Użycie strony kodowej \s-1DOS 865 \s0(nordyckiej).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Konwersja znaków 8\-bitowych do przestrzeni 7\-bitowej.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Zachowanie znaku \s-1BOM \s0(Byte Order Makr). Jeżeli plik wejściowy zawiera \s-1BOM,\s0
powoduje zapisanie go w pliku wyjściowym. Jest to domyślne zachowanie przy
konwersji na DOS-owe końce linii. P. także opcja \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1TRYB_KONW\s0\fR" 4
.IX Item "-c, --convmode TRYB_KONW"
Ustawienie trybu konwersji. \s-1TRYB_KONW\s0 to jeden z: \fIascii\fR, \fI7bit\fR, \fIiso\fR,
\&\fImac\fR, przy czym domyślny jest ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Wymuszenie konwersji plików binarnych.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Pod Windows pliki w \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8,\s0 niezależnie
od ustawienia lokalizacji. Ta opcja pozwala przekonwertować pliki w \s-1UTF\-16\s0
do \s-1GB18030.\s0 Opcja jest dostępna tylko pod Windows, więcej w sekcji
dotyczącej \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Wyświetlenie opisu i zakończenie.
.IP "\fB\-i[\s-1FLAGI\s0], \-\-info[=FLAGI] \s-1PLIK ...\s0\fR" 4
.IX Item "-i[FLAGI], --info[=FLAGI] PLIK ..."
Wyświetlenie informacji o pliku. Konwersja nie jest wykonywana.
.Sp
Wypisywane są następujące informacje, w tej kolejności: liczba DOS-owych
końców linii, liczba uniksowych końców linii, liczba macowych końców linii,
znacznik \s-1BOM,\s0 tekstowy lub binarny, nazwa pliku.
.Sp
Przykładowe wyjście:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcjonalnie można ustawić dodatkowe flagi, aby zmienić wyjście. Można dodać
jedną lub więcej flag.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Wypisanie liczby DOS-owych końców linii.
.IP "\fBu\fR" 4
.IX Item "u"
Wypisanie liczby uniksowych końców linii.
.IP "\fBm\fR" 4
.IX Item "m"
Wypisanie liczby macowych końców linii.
.IP "\fBb\fR" 4
.IX Item "b"
Wypisanie znacznika \s-1BOM.\s0
.IP "\fBt\fR" 4
.IX Item "t"
Wypisanie, czy plik jest tekstowy, czy binarny.
.IP "\fBc\fR" 4
.IX Item "c"
Wypisanie tylko plików, które zostałyby przekonwertowane.
.Sp
Z flagą \f(CW\*(C`c\*(C'\fR dos2unix wypisze tylko pliki zawierające DOS-owe końce linii, a
unix2dos wypisze tylko nazwy plików zawierających uniksowe końce linii.
.RE
.RS 4
.Sp
Przykłady:
.Sp
Pokazanie informacji o wszystkich plikach *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Pokazanie tylko liczby DOS-owych i uniksowych końców linii:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Pokazanie tylko znacznika \s-1BOM:\s0
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Wypisanie listy plików zawierających DOS-owe końce linii:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Wypisanie listy plików zawierających uniksowe końce linii:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Zachowanie znacznika czasu pliku wyjściowego takiego samego, jak pliku
wejściowego.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Wyświetlenie licencji programu.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Dodanie dodatkowego znaku końca linii.
.Sp
\&\fBdos2unix\fR: tylko DOS-owe znaki końca linii są zamieniane na dwa
uniksowe. W trybie Mac tylko macowe znaki końca linii są zamieniane na dwa
uniksowe.
.Sp
\&\fBunix2dos\fR: tylko uniksowe znaki końca linii są zamieniane na dwa
DOS-owe. W trybie Mac uniksowe znaki końca linii są zamieniane na dwa
macowe.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Zapisanie znacznika \s-1BOM \s0(Byte Order Mark) w pliku wyjściowym. Domyślnie
zapisywany jest \s-1BOM UTF\-8.\s0
.Sp
Jeśli plik wejściowy jest w kodowaniu \s-1UTF\-16\s0 i użyto opcji \f(CW\*(C`\-u\*(C'\fR, zostanie
zapisany \s-1BOM UTF\-16.\s0
.Sp
Nigdy nie należy używać tej opcji, jeśli kodowanie wyjściowe jest inne niż
\&\s-1UTF\-8\s0 lub \s-1UTF\-16.\s0 Więcej w sekcji \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1PLIK_WEJ PLIK_WYJ ...\s0\fR" 4
.IX Item "-n, --newfile PLIK_WEJ PLIK_WYJ ..."
Tryb nowego pliku. Konwersja \s-1PLIKU_WEJ\s0 z zapisem wyjścia do \s-1PLIKU_WYJ.\s0 Nazwy
plików muszą być podane parami, a masek \fInie\fR należy używać, gdyż
\&\fIspowoduje\fR to utratę plików.
.Sp
Osoba uruchamiająca konwersję w trybie nowego pliku (par) będzie
właścicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego pliku
będą pochodziły z praw pliku oryginalnego po odjęciu \fIumask\fR\|(1) osoby
uruchamiającej konwersję.
.IP "\fB\-o, \-\-oldfile \s-1PLIK ...\s0\fR" 4
.IX Item "-o, --oldfile PLIK ..."
Tryb starego pliku. Konwersja \s-1PLIKU\s0 i nadpisanie go wyjściem. Program działa
domyślnie w tym trybie. Można używać masek.
.Sp
W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje tego
samego właściciela, grupę oraz prawa odczytu/zapisu, jak plik oryginalny \-
także wtedy, gdy plik jest konwertowany przez innego użytkownika, mającego
prawo zapisu do pliku (np. przez użytkownika root). Konwersja zostanie
przerwana, jeśli nie będzie możliwe zachowanie oryginalnych wartości. Zmiana
właściciela mogłaby oznaczać, że pierwotny właściciel nie może już odczytać
pliku. Zmiana grupy mogłaby być zagrożeniem bezpieczeństwa, plik mógłby być
czytelny dla nie zamierzonych osób. Zachowanie właściciela, grupy i praw
odczytu/zapisu jest obsługiwane tylko na Uniksie.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Tryb cichy. Pominięcie wszystkich ostrzeżeń i komunikatów. Zwracanym kodem
jest zero, chyba że podano błędne opcje linii poleceń.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Usunięcie znaków \s-1BOM \s0(Byte Order Mark). Bez zapisywania \s-1BOM\s0 do pliku
wyjściowego. Jest to domyślne zachowanie przy konwersji na uniksowe końce
linii. P. także opcja \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Pominięcie plików binarnych (domyślne).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Zachowanie oryginalnego kodowania pliku wejściowego \s-1UTF\-16.\s0 Plik wyjściowy
zostanie zapisany w tym samym kodowaniu \s-1UTF\-16 \s0(little lub big endian), co
plik wejściowy. Zapobiega to przekształceniu do \s-1UTF\-8.\s0 Do pliku zostanie
zapisany odpowiedni znacznik \s-1BOM UTF\-16.\s0 Tę opcję można wyłączyć opcją
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16LE.\s0
.Sp
Jeśli w pliku wejściowym jest znacznik \s-1BOM \s0(Byte Order Mark), ma on
priorytet nad tą opcją.
.Sp
Jeśli przyjęto błędne założenie (plik wejściowy nie jest w formacie
\&\s-1UTF\-16LE\s0), a konwersja się uda, wynikiem będzie plik wyjściowy \s-1UTF\-8\s0 ze złym
tekstem. Konwersję tę można odwrócić przy użyciu polecenia \fIiconv\fR\|(1) do
konwersji wyjścia \s-1UTF\-8\s0 z powrotem do \s-1UTF\-16LE.\s0 Przywróci to plik
oryginalny.
.Sp
Przyjęcie \s-1UTF\-16LE\s0 działa jako \fItryb konwersji\fR. Przy przełączeniu na
domyślny tryb \fIascii\fR przyjęcie \s-1UTF\-16LE\s0 jest wyłączane.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16BE.\s0
.Sp
Ta opcja działa analogicznie do \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Wyświetlanie szczegółowych komunikatów. Wyświetlane śa dodatkowe informacje
o znacznikach \s-1BOM \s0(Byte Order Mark) oraz liczbie przekonwertowanych końców
linii.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Podążanie za dowiązaniami symbolicznymi i konwertowanie ich celów
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Zastępowanie dowiązań symbolicznych przekonwertowanymi plikami (oryginalne
pliki docelowe pozostają bez zmian).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Pozostawienie dowiązań symbolicznych i celów bez zmian (domyślne).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Wyświetlenie informacji o wersji i zakończenie.
.SH "TRYB MAC"
.IX Header "TRYB MAC"
W zwykłym trybie znaki końca linii są konwertowane z DOS-a do Uniksa i
odwrotnie. Znaki końca linii systemu Mac nie są konwertowane.
.PP
W trybie Mac znaki końca linii są konwertowane z formatu Maca do Uniksa i
odwrotnie. Znaki końca linii systemu \s-1DOS\s0 nie są zmieniane.
.PP
Aby uruchomić program w trybie Mac, należy użyć opcji linii poleceń \f(CW\*(C`\-c
mac\*(C'\fR albo użyć poleceń \f(CW\*(C`mac2unix\*(C'\fR lub \f(CW\*(C`unix2mac\*(C'\fR.
.SH "TRYBY KONWERSJI"
.IX Header "TRYBY KONWERSJI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
W trybie \f(CW\*(C`ascii\*(C'\fR konwertowane są tylko końce linii. Jest to domyślny tryb
konwersji.
.Sp
Mimo że nazwa tego trybu to \s-1ASCII,\s0 które jest standardem 7\-bitowym, jest to
tryb 8\-bitowy. Należy zawsze używać tego trybu przy konwersji plików Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
W tym trybie wszystkie znaki 8\-bitowe spoza \s-1ASCII \s0(o wartościach od 128 do
255) są konwertowane do przestrzeni 7\-bitowej.
.IP "\fBiso\fR" 4
.IX Item "iso"
W tym trybie znaki są konwertowane między zestawem znaków \s-1DOS \s0(stroną
kodową) a zestawem znaków \s-1ISO\-8859\-1 \s0(Latin\-1) używanym na Uniksie. Znaki
DOS-owe nie mające odpowiednika w \s-1ISO\-8859\-1,\s0 których nie da się
przekonwertować, są zamieniane na kropkę. To samo dotyczy znaków \s-1ISO\-8859\-1\s0
bez odpowiednika w DOS-ie.
.Sp
Jeśli używana jest tylko opcja \f(CW\*(C`\-iso\*(C'\fR, dos2unix próbuje wykryć aktywną
stronę kodową. Jeśli nie jest to możliwe, dos2unix używa domyślnej strony
kodowej \s-1CP437,\s0 stosowanej głównie w \s-1USA.\s0 Aby wymusić określoną stronę
kodową, należy użyć opcji \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (zachodnioeuropejska),
\&\f(CW\*(C`\-860\*(C'\fR (portugalska), \f(CW\*(C`\-863\*(C'\fR (kanadyjska francuska) lub \f(CW\*(C`\-865\*(C'\fR
(nordycka). Ponadto obsługiwana jest strona kodowa Windows \s-1CP1252
\&\s0(zachodnioeuropejska) przy użyciu opcji \f(CW\*(C`\-1252\*(C'\fR. W przypadku innych stron
kodowych można użyć narzędzia dos2unix wraz z \fIiconv\fR\|(1). Iconv potrafi
konwertować między wieloma kodowaniami znaków.
.Sp
Nigdy nie należy używać konwersji \s-1ISO\s0 na plikach tekstowych w
Unicode. Uszkodziłaby pliki kodowane \s-1UTF\-8.\s0
.Sp
Kilka przykładów:
.Sp
Konwersja z domyślnej strony kodowej \s-1DOS\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej \s-1DOS CP850\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Konwersa z uniksowego Latin\-1 do domyślnej strony kodowej \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego \s-1UTF\-8 \s0(Unicode) do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Więcej pod adresem <http://czyborra.com/charsets/codepages.html> oraz
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Kodowania"
.IX Subsection "Kodowania"
Istnieją różne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode są
zwykle kodowane z użyciem \s-1UTF\-8.\s0 Pod Windows pliki tekstowe Unicode mogą być
kodowane w \s-1UTF\-8, UTF\-16, UTF\-16\s0 big-endian, ale przeważnie są kodowane w
\&\s-1UTF\-16.\s0
.SS "Konwersje"
.IX Subsection "Konwersje"
Pliki tekstowe Unicode mogą mieć znaki końca linii systemu \s-1DOS,\s0 Unix lub
Mac, podobnie jak zwykłe pliki tekstowe.
.PP
Wszystkie wersje dos2unix i unix2dos potrafią konwertować pliki kodowane
\&\s-1UTF\-8,\s0 ponieważ \s-1UTF\-8\s0 jest wstecznie zgodne z \s-1ASCII.\s0
.PP
Dos2unix i unix2dos z obsługą Unicode \s-1UTF\-16\s0 potrafią odczytywać pliki
tekstowe kodowane \s-1UTF\-16\s0 little\- oraz big-endian. Aby sprawdzić, czy
dos2unix został zbudowany z obsługą \s-1UTF\-16,\s0 należy napisać \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Pod Uniksem/Linuksem pliki w kodowaniu \s-1UTF\-16\s0 są konwertowane do kodowania
znaków ustawionej lokalizacji. Kodowanie znaków dla lokalizacji można
sprawdzić poleceniem \fIlocale\fR\|(1). Jeśli konwersja nie jest możliwa, wystąpi
błąd, a plik zostanie pominięty.
.PP
Pod Windows pliki \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8.\s0 Pliki tekstkowe
w kodowaniu \s-1UTF\-8\s0 są dobrze obsługiwane zarówno pod Windows, jak i
Uniksem/Linuksem.
.PP
Kodowania \s-1UTF\-16\s0 i \s-1UTF\-8\s0 są w pełni zgodne, konwersja nie spowoduje utraty
żadnej części tekstu. W przypadku wystąpienia błędu konwersji, na przykład w
przypadku błędu w pliku wejściowym \s-1UTF\-16,\s0 plik zostanie pominięty.
.PP
W przypadku użycia opcji \f(CW\*(C`\-u\*(C'\fR, plik wejściowy zostanie zapisany w tym samym
kodowaniu \s-1UTF\-16,\s0 co plik wejściowy. Opcja \f(CW\*(C`\-u\*(C'\fR zapobiega konwersji do
\&\s-1UTF\-8.\s0
.PP
Dos2unix oraz unix2dos nie mają opcji pozwalającej na konwersję plików \s-1UTF\-8\s0
do \s-1UTF\-16.\s0
.PP
Tryby konwersji \s-1ISO\s0 i 7\-bit nie działają na plikach \s-1UTF\-16.\s0
.SS "Znacznik \s-1BOM\s0"
.IX Subsection "Znacznik BOM"
W systemie Windows pliki tekstowe zwykle zawierają znacznik \s-1BOM \s0(Byte Order
Mark), ponieważ wiele programów dla Windows (w tym Notepad) dodaje domyślnie
znaczniki \s-1BOM.\s0 Więcej informacji można znaleźć pod adresem
<http://pl.wikipedia.org/wiki/BOM_(informatyka)>.
.PP
Pod Uniksem pliki Unicode zwykle nie mają znacznika \s-1BOM.\s0 Pliki tekstowe są
traktowane jako kodowane zgodnie z kodowaniem znaków ustawionej lokalizacji.
.PP
Dos2unix potrafi wykryć tylko, czy plik jest w formacie \s-1UTF\-16,\s0 jeśli
zawiera znacznik \s-1BOM.\s0 Jeśli plik \s-1UTF\-16\s0 nie ma tego znacznika, dos2unix
potraktuje plik jako binarny.
.PP
Do konwersji pliku \s-1UTF\-16\s0 bez znacznika \s-1BOM\s0 można użyć opcji \f(CW\*(C`\-ul\*(C'\fR lub
\&\f(CW\*(C`\-ub\*(C'\fR.
.PP
Dos2unix nie zapisuje domyślnie znaku \s-1BOM\s0 w pliku wyjściowym. Z opcją \f(CW\*(C`\-b\*(C'\fR
Dos2unix zapisuje \s-1BOM,\s0 jeśli plik wejściowy zawiera \s-1BOM.\s0
.PP
Unix2dos domyślnie zapisuje znaczniki \s-1BOM\s0 w pliku wyjściowym, jeśli plik
wejściowy ma \s-1BOM.\s0 Aby usunąć \s-1BOM,\s0 można użyć opcji \f(CW\*(C`\-r\*(C'\fR.
.PP
Dos2unix oraz unix2dos zawsze zapisują znaczniki \s-1BOM,\s0 jeśli użyta zostanie
opcja \f(CW\*(C`\-m\*(C'\fR.
.SS "Przykłady Unicode"
.IX Subsection "Przykłady Unicode"
Konwersja pliku \s-1UTF\-16 \s0(z \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Konwersja pliku \s-1UTF\-16LE \s0(bez \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-8\s0 z \s-1BOM\s0 dla Windows:
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-16\s0 dla Windows:
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 to standard urzędowy w Chinach. Obowiązkowy podzbiór standardu
\&\s-1GB18030\s0 jest oficjalnym wymaganiem każdego oprogramowania sprzedawanego w
Chinach. Więcej pod adresem <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 jest w pełni zgodny z Unicode i może być uważany za format
transformacji unikodu. Podobnie jak \s-1UTF\-8, GB18030\s0 jest zgodny z \s-1ASCII.\s0 Jest
także zgodny ze stroną kodową Windows 936, znaną też jako \s-1GBK.\s0
.PP
Pod Uniksem/Linuksem pliki \s-1UTF\-16\s0 są konwertowane do \s-1GB18030,\s0 jeśli
kodowanie dla lokalizacji jest ustawione na \s-1GB18030.\s0 Uwaga: będzie to
działać tylko dla lokalizacji chińskiej. W przypadku np. ustawienia
lokalizacji angielskiej/brytyjskiej \f(CW\*(C`en_GB.GB18030\*(C'\fR konwersja \s-1UTF\-16\s0 do
\&\s-1GB18030\s0 nie będzie działać, a dla lokalizacji chińskiej \f(CW\*(C`zh_CN.GB18030\*(C'\fR
będzie.
.PP
Pod Windows w celu konwersji plików \s-1UTF\-16\s0 do \s-1GB18030\s0 należy użyć opcji
\&\f(CW\*(C`\-gb\*(C'\fR.
.PP
Pliki w kodowaniu \s-1GB18030\s0 mogą mieć znacznik \s-1BOM,\s0 podobnie jak pliki w
Unicode.
.SH "PRZYKŁADY"
.IX Header "PRZYKŁADY"
Odczyt ze standardowego wejścia i zapis na standardowe wyjście:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja i zastąpienie b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii; konwersja i zastąpienie b.txt
w trybie 7\-bitowym:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Konwersja a.txt z formatu Mac do formatu uniksowego:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Konwersja a.txt z formatu uniksowego do formatu Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt z zachowaniem oryginalnego znacznika czasu:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt
takiego, jak a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja b.txt i zapis do e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Konwersja c.txt i zapis do e.txt; konwersja i zastąpienie a.txt; konwersja i
zastąpienie b.txt; konwersja d.txt i zapis do f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "KONWERSJA REKURENCYJNA"
.IX Header "KONWERSJA REKURENCYJNA"
Można użyć dos2unix w połączeniu z poleceniami \fIfind\fR\|(1) i \fIxargs\fR\|(1) do
rekurencyjnej konwersji plików tekstowych w strukturze drzewa katalogów. Na
przykład, aby przekonwertować wszystkie pliki .txt w drzewie katalogów
poniżej katalogu bieżącego, należy napisać:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALIZACJA"
.IX Header "LOKALIZACJA"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Główny język wybiera się zmienną środowiskową \s-1LANG.\s0 Zmienna \s-1LANG\s0 składa się
z kilku części. Pierwsza część to małe litery oznaczające kod języka. Druga
część jest opcjonalna i zawiera kod kraju pisany wielkimi literami,
poprzedzony podkreśleniem. Jest także opcjonalna trzecia część: kodowanie
znaków, poprzedzone kropką. Kilka przykładów dla powłok zgodnych ze
standardem \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl holenderski
\& export LANG=nl_NL holenderski, Holandia
\& export LANG=nl_BE holenderski, Belgia
\& export LANG=es_ES hiszpański, Hiszpania
\& export LANG=es_MX hiszpański, Meksyk
\& export LANG=en_US.iso88591 angielski, USA, kodowanie Latin\-1
\& export LANG=en_GB.UTF\-8 angielski, Wlk. Brytania, kodowanie UTF\-8
.Ve
.Sp
Pełną listę kodów języków i krajów można znaleźć w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
W systemach uniksowych do uzyskania informacji dotyczących lokalizacji można
użyć polecenia \fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Przy użyciu zmiennej środowiskowej \s-1LANGUAGE\s0 można określić listę języków wg
priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje pierwszeństwo
zmiennej \s-1LANGUAGE\s0 nad \s-1LANG.\s0 Na przykład, najpierw holenderski, następnie
niemiecki: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Aby skorzystać z listy wg priorytetów ze
zmiennej \s-1LANGUAGE,\s0 trzeba najpierw włączyć lokalizację przez ustawienie
zmiennej \s-1LANG \s0(lub \s-1LC_ALL\s0) na wartość inną niż \*(L"C\*(R". Więcej informacji
znajduje się w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
W przypadku wybrania niedostępnego języka, otrzymamy standardowe, angielskie
komunikaty.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Przy użyciu zmiennej środowiskowej \s-1DOS2UNIX_LOCALEDIR,\s0 można nadpisać
ustawienie \s-1LOCALEDIR\s0 z czasu kompilacji. \s-1LOCALEDIR\s0 to katalog używany do
znalezienia plików lokalizacji. Domyślną wartością dla \s-1GNU\s0 jest
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Opcja \fB\-\-version\fR wyświetla używaną wartość
\&\s-1LOCALEDIR.\s0
.Sp
Przykład (dla powłoki \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "WARTOŚĆ ZWRACANA"
.IX Header "WARTOŚĆ ZWRACANA"
W przypadku powodzenia zwracane jest zero. Jeśli wystąpi błąd systemowy,
zwracany jest ostatni błąd systemowy. W przypadku innych błędów zwracane
jest 1.
.PP
Wartość zwracana w trybie cichym to zawsze zero, z wyjątkiem sytuacji
podania błędnych opcji linii poleceń.
.SH "STANDARDY"
.IX Header "STANDARDY"
<http://pl.wikipedia.org/wiki/Plik_tekstowy>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://pl.wikipedia.org/wiki/End\-of\-line>
.PP
<http://pl.wikipedia.org/wiki/Unicode>
.SH "AUTORZY"
.IX Header "AUTORZY"
Benjamin Lin <blin@socs.uts.edu.au>; Bernd Johannes Wuebben (tryb mac2unix)
<wuebben@kde.org>; Christian Wurll (dodawanie dodatkowej nowej linii)
<wurll@ira.uka.de>; Erwin Waterlander <waterlan@xs4all.nl> (prowadzący)
.PP
Strona projektu: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Strona SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ZOBACZ TAKŻE"
.IX Header "ZOBACZ TAKŻE"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,756 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAZWA"
.IX Header "NAZWA"
dos2unix \- konwerter formatu plików tekstowych między systemami DOS/Mac a
Uniksem
.SH "SKŁADNIA"
.IX Header "SKŁADNIA"
.Vb 2
\& dos2unix [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
\& unix2dos [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
.Ve
.SH "OPIS"
.IX Header "OPIS"
Pakiet Dos2unix zawiera narzędzia \f(CW\*(C`dos2unix\*(C'\fR oraz \f(CW\*(C`unix2dos\*(C'\fR do konwersji
zwykłych plików tekstowych między formatami używanymi w systemach \s-1DOS\s0 lub
Mac a formatem uniksowym.
.PP
W plikach tekstowych systemu DOS/Windows oznaczenie końca linii to
połączenie dwóch znaków: powrotu karetki (\s-1CR\s0) i przesunięcia linii (\s-1LF\s0). W
uniksowych plikach tekstowych koniec linii to pojedynczy znak \s-1LF. W\s0 plikach
tekstowych systemu Mac sprzed Mac \s-1OS X\s0 koniec linii był pojedynczym znakiem
\&\s-1CR.\s0 Obecnie Mac \s-1OS\s0 wykorzystuje uniksowe końce linii (\s-1LF\s0).
.PP
Oprócz oznaczeń końców linii Dos2unix potrafi konwertować także kodowanie
plików. Kilko stron kodowych DOS-a może być przekonwertowanych do uniksowego
Latin\-1, a windowsowy Unicode (\s-1UTF\-16\s0) do powszechniejszego pod Uniksem
kodowania Unicode \s-1UTF\-8.\s0
.PP
Pliki binarne są pomijane automatycznie, chyba że konwersja zostanie
wymuszona.
.PP
Pliki inne niż zwykłe, np. katalogi lub \s-1FIFO,\s0 są pomijane automatycznie.
.PP
Dowiązania symboliczne i ich cele są domyślnie pozostawiane bez
zmian. Dowiązania symboliczne mogą być opcjonalnie zastępowane, albo wyjście
może być zapisywane do celu dowiązania. Zapis do celu dowiązania
symbolicznego nie jest obsługiwane pod Windows.
.PP
Dos2unix powstał na podstawie narzędzia dos2unix z systemu
SunOS/Solaris. Jest jedna istotna różnica w stosunku do oryginalnej wersji z
SunOS\-a/Solarisa: ta wersja domyślnie wykonuje konwersję w miejscu (tryb
starego pliku), podczas gdy oryginalna obsługiwała tylko konwersję parami
(tryb nowego pliku) \- p. także opcje \f(CW\*(C`\-o\*(C'\fR i \f(CW\*(C`\-n\*(C'\fR.
.SH "OPCJE"
.IX Header "OPCJE"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Potraktowanie wszystkich kolejnych opcji jako nazw plików. Tej opcji należy
użyć, aby przekonwertować pliki, których nazwy zaczynają się od
minusa. Przykładowo, aby przekonwertować plik o nazwie \*(L"\-foo\*(R", można użyć
polecenia:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Lub w trybie nowego pliku:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Konwersja tylko znaków końca linii. Jest to domyślny tryb konwersji.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Konwersja między zestawami znaków \s-1DOS\s0 i \s-1ISO\-8859\-1.\s0 Więcej w sekcji \s-1TRYBY
KONWERSJI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Użycie strony kodowej Windows 1252 (zachodnioeuropejskiej).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Użycie strony kodowej \s-1DOS 437 \s0(\s-1US\s0). Jest to domyślna strona kodowa używana
przy konwersji \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Użycie strony kodowej \s-1DOS 850 \s0(zachodnioeuropejskiej).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Użycie strony kodowej \s-1DOS 860 \s0(portugalskiej).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Użycie strony kodowej \s-1DOS 863 \s0(kanadyjskiej francuskiej).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Użycie strony kodowej \s-1DOS 865 \s0(nordyckiej).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Konwersja znaków 8\-bitowych do przestrzeni 7\-bitowej.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Zachowanie znaku \s-1BOM \s0(Byte Order Makr). Jeżeli plik wejściowy zawiera \s-1BOM,\s0
powoduje zapisanie go w pliku wyjściowym. Jest to domyślne zachowanie przy
konwersji na DOS-owe końce linii. P. także opcja \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1TRYB_KONW\s0\fR" 4
.IX Item "-c, --convmode TRYB_KONW"
Ustawienie trybu konwersji. \s-1TRYB_KONW\s0 to jeden z: \fIascii\fR, \fI7bit\fR, \fIiso\fR,
\&\fImac\fR, przy czym domyślny jest ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Wymuszenie konwersji plików binarnych.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Pod Windows pliki w \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8,\s0 niezależnie
od ustawienia lokalizacji. Ta opcja pozwala przekonwertować pliki w \s-1UTF\-16\s0
do \s-1GB18030.\s0 Opcja jest dostępna tylko pod Windows, więcej w sekcji
dotyczącej \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Wyświetlenie opisu i zakończenie.
.IP "\fB\-i[\s-1FLAGI\s0], \-\-info[=FLAGI] \s-1PLIK ...\s0\fR" 4
.IX Item "-i[FLAGI], --info[=FLAGI] PLIK ..."
Wyświetlenie informacji o pliku. Konwersja nie jest wykonywana.
.Sp
Wypisywane są następujące informacje, w tej kolejności: liczba DOS-owych
końców linii, liczba uniksowych końców linii, liczba macowych końców linii,
znacznik \s-1BOM,\s0 tekstowy lub binarny, nazwa pliku.
.Sp
Przykładowe wyjście:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcjonalnie można ustawić dodatkowe flagi, aby zmienić wyjście. Można dodać
jedną lub więcej flag.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Wypisanie liczby DOS-owych końców linii.
.IP "\fBu\fR" 4
.IX Item "u"
Wypisanie liczby uniksowych końców linii.
.IP "\fBm\fR" 4
.IX Item "m"
Wypisanie liczby macowych końców linii.
.IP "\fBb\fR" 4
.IX Item "b"
Wypisanie znacznika \s-1BOM.\s0
.IP "\fBt\fR" 4
.IX Item "t"
Wypisanie, czy plik jest tekstowy, czy binarny.
.IP "\fBc\fR" 4
.IX Item "c"
Wypisanie tylko plików, które zostałyby przekonwertowane.
.Sp
Z flagą \f(CW\*(C`c\*(C'\fR dos2unix wypisze tylko pliki zawierające DOS-owe końce linii, a
unix2dos wypisze tylko nazwy plików zawierających uniksowe końce linii.
.RE
.RS 4
.Sp
Przykłady:
.Sp
Pokazanie informacji o wszystkich plikach *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Pokazanie tylko liczby DOS-owych i uniksowych końców linii:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Pokazanie tylko znacznika \s-1BOM:\s0
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Wypisanie listy plików zawierających DOS-owe końce linii:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Wypisanie listy plików zawierających uniksowe końce linii:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Zachowanie znacznika czasu pliku wyjściowego takiego samego, jak pliku
wejściowego.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Wyświetlenie licencji programu.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Dodanie dodatkowego znaku końca linii.
.Sp
\&\fBdos2unix\fR: tylko DOS-owe znaki końca linii są zamieniane na dwa
uniksowe. W trybie Mac tylko macowe znaki końca linii są zamieniane na dwa
uniksowe.
.Sp
\&\fBunix2dos\fR: tylko uniksowe znaki końca linii są zamieniane na dwa
DOS-owe. W trybie Mac uniksowe znaki końca linii są zamieniane na dwa
macowe.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Zapisanie znacznika \s-1BOM \s0(Byte Order Mark) w pliku wyjściowym. Domyślnie
zapisywany jest \s-1BOM UTF\-8.\s0
.Sp
Jeśli plik wejściowy jest w kodowaniu \s-1UTF\-16\s0 i użyto opcji \f(CW\*(C`\-u\*(C'\fR, zostanie
zapisany \s-1BOM UTF\-16.\s0
.Sp
Nigdy nie należy używać tej opcji, jeśli kodowanie wyjściowe jest inne niż
\&\s-1UTF\-8\s0 lub \s-1UTF\-16.\s0 Więcej w sekcji \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1PLIK_WEJ PLIK_WYJ ...\s0\fR" 4
.IX Item "-n, --newfile PLIK_WEJ PLIK_WYJ ..."
Tryb nowego pliku. Konwersja \s-1PLIKU_WEJ\s0 z zapisem wyjścia do \s-1PLIKU_WYJ.\s0 Nazwy
plików muszą być podane parami, a masek \fInie\fR należy używać, gdyż
\&\fIspowoduje\fR to utratę plików.
.Sp
Osoba uruchamiająca konwersję w trybie nowego pliku (par) będzie
właścicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego pliku
będą pochodziły z praw pliku oryginalnego po odjęciu \fIumask\fR\|(1) osoby
uruchamiającej konwersję.
.IP "\fB\-o, \-\-oldfile \s-1PLIK ...\s0\fR" 4
.IX Item "-o, --oldfile PLIK ..."
Tryb starego pliku. Konwersja \s-1PLIKU\s0 i nadpisanie go wyjściem. Program działa
domyślnie w tym trybie. Można używać masek.
.Sp
W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje tego
samego właściciela, grupę oraz prawa odczytu/zapisu, jak plik oryginalny \-
także wtedy, gdy plik jest konwertowany przez innego użytkownika, mającego
prawo zapisu do pliku (np. przez użytkownika root). Konwersja zostanie
przerwana, jeśli nie będzie możliwe zachowanie oryginalnych wartości. Zmiana
właściciela mogłaby oznaczać, że pierwotny właściciel nie może już odczytać
pliku. Zmiana grupy mogłaby być zagrożeniem bezpieczeństwa, plik mógłby być
czytelny dla nie zamierzonych osób. Zachowanie właściciela, grupy i praw
odczytu/zapisu jest obsługiwane tylko na Uniksie.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Tryb cichy. Pominięcie wszystkich ostrzeżeń i komunikatów. Zwracanym kodem
jest zero, chyba że podano błędne opcje linii poleceń.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Usunięcie znaków \s-1BOM \s0(Byte Order Mark). Bez zapisywania \s-1BOM\s0 do pliku
wyjściowego. Jest to domyślne zachowanie przy konwersji na uniksowe końce
linii. P. także opcja \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Pominięcie plików binarnych (domyślne).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Zachowanie oryginalnego kodowania pliku wejściowego \s-1UTF\-16.\s0 Plik wyjściowy
zostanie zapisany w tym samym kodowaniu \s-1UTF\-16 \s0(little lub big endian), co
plik wejściowy. Zapobiega to przekształceniu do \s-1UTF\-8.\s0 Do pliku zostanie
zapisany odpowiedni znacznik \s-1BOM UTF\-16.\s0 Tę opcję można wyłączyć opcją
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16LE.\s0
.Sp
Jeśli w pliku wejściowym jest znacznik \s-1BOM \s0(Byte Order Mark), ma on
priorytet nad tą opcją.
.Sp
Jeśli przyjęto błędne założenie (plik wejściowy nie jest w formacie
\&\s-1UTF\-16LE\s0), a konwersja się uda, wynikiem będzie plik wyjściowy \s-1UTF\-8\s0 ze złym
tekstem. Konwersję tę można odwrócić przy użyciu polecenia \fIiconv\fR\|(1) do
konwersji wyjścia \s-1UTF\-8\s0 z powrotem do \s-1UTF\-16LE.\s0 Przywróci to plik
oryginalny.
.Sp
Przyjęcie \s-1UTF\-16LE\s0 działa jako \fItryb konwersji\fR. Przy przełączeniu na
domyślny tryb \fIascii\fR przyjęcie \s-1UTF\-16LE\s0 jest wyłączane.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16BE.\s0
.Sp
Ta opcja działa analogicznie do \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Wyświetlanie szczegółowych komunikatów. Wyświetlane śa dodatkowe informacje
o znacznikach \s-1BOM \s0(Byte Order Mark) oraz liczbie przekonwertowanych końców
linii.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Podążanie za dowiązaniami symbolicznymi i konwertowanie ich celów
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Zastępowanie dowiązań symbolicznych przekonwertowanymi plikami (oryginalne
pliki docelowe pozostają bez zmian).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Pozostawienie dowiązań symbolicznych i celów bez zmian (domyślne).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Wyświetlenie informacji o wersji i zakończenie.
.SH "TRYB MAC"
.IX Header "TRYB MAC"
W zwykłym trybie znaki końca linii są konwertowane z DOS-a do Uniksa i
odwrotnie. Znaki końca linii systemu Mac nie są konwertowane.
.PP
W trybie Mac znaki końca linii są konwertowane z formatu Maca do Uniksa i
odwrotnie. Znaki końca linii systemu \s-1DOS\s0 nie są zmieniane.
.PP
Aby uruchomić program w trybie Mac, należy użyć opcji linii poleceń \f(CW\*(C`\-c
mac\*(C'\fR albo użyć poleceń \f(CW\*(C`mac2unix\*(C'\fR lub \f(CW\*(C`unix2mac\*(C'\fR.
.SH "TRYBY KONWERSJI"
.IX Header "TRYBY KONWERSJI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
W trybie \f(CW\*(C`ascii\*(C'\fR konwertowane są tylko końce linii. Jest to domyślny tryb
konwersji.
.Sp
Mimo że nazwa tego trybu to \s-1ASCII,\s0 które jest standardem 7\-bitowym, jest to
tryb 8\-bitowy. Należy zawsze używać tego trybu przy konwersji plików Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
W tym trybie wszystkie znaki 8\-bitowe spoza \s-1ASCII \s0(o wartościach od 128 do
255) są konwertowane do przestrzeni 7\-bitowej.
.IP "\fBiso\fR" 4
.IX Item "iso"
W tym trybie znaki są konwertowane między zestawem znaków \s-1DOS \s0(stroną
kodową) a zestawem znaków \s-1ISO\-8859\-1 \s0(Latin\-1) używanym na Uniksie. Znaki
DOS-owe nie mające odpowiednika w \s-1ISO\-8859\-1,\s0 których nie da się
przekonwertować, są zamieniane na kropkę. To samo dotyczy znaków \s-1ISO\-8859\-1\s0
bez odpowiednika w DOS-ie.
.Sp
Jeśli używana jest tylko opcja \f(CW\*(C`\-iso\*(C'\fR, dos2unix próbuje wykryć aktywną
stronę kodową. Jeśli nie jest to możliwe, dos2unix używa domyślnej strony
kodowej \s-1CP437,\s0 stosowanej głównie w \s-1USA.\s0 Aby wymusić określoną stronę
kodową, należy użyć opcji \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (zachodnioeuropejska),
\&\f(CW\*(C`\-860\*(C'\fR (portugalska), \f(CW\*(C`\-863\*(C'\fR (kanadyjska francuska) lub \f(CW\*(C`\-865\*(C'\fR
(nordycka). Ponadto obsługiwana jest strona kodowa Windows \s-1CP1252
\&\s0(zachodnioeuropejska) przy użyciu opcji \f(CW\*(C`\-1252\*(C'\fR. W przypadku innych stron
kodowych można użyć narzędzia dos2unix wraz z \fIiconv\fR\|(1). Iconv potrafi
konwertować między wieloma kodowaniami znaków.
.Sp
Nigdy nie należy używać konwersji \s-1ISO\s0 na plikach tekstowych w
Unicode. Uszkodziłaby pliki kodowane \s-1UTF\-8.\s0
.Sp
Kilka przykładów:
.Sp
Konwersja z domyślnej strony kodowej \s-1DOS\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej \s-1DOS CP850\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Konwersa z uniksowego Latin\-1 do domyślnej strony kodowej \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego \s-1UTF\-8 \s0(Unicode) do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Więcej pod adresem <http://czyborra.com/charsets/codepages.html> oraz
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Kodowania"
.IX Subsection "Kodowania"
Istnieją różne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode są
zwykle kodowane z użyciem \s-1UTF\-8.\s0 Pod Windows pliki tekstowe Unicode mogą być
kodowane w \s-1UTF\-8, UTF\-16, UTF\-16\s0 big-endian, ale przeważnie są kodowane w
\&\s-1UTF\-16.\s0
.SS "Konwersje"
.IX Subsection "Konwersje"
Pliki tekstowe Unicode mogą mieć znaki końca linii systemu \s-1DOS,\s0 Unix lub
Mac, podobnie jak zwykłe pliki tekstowe.
.PP
Wszystkie wersje dos2unix i unix2dos potrafią konwertować pliki kodowane
\&\s-1UTF\-8,\s0 ponieważ \s-1UTF\-8\s0 jest wstecznie zgodne z \s-1ASCII.\s0
.PP
Dos2unix i unix2dos z obsługą Unicode \s-1UTF\-16\s0 potrafią odczytywać pliki
tekstowe kodowane \s-1UTF\-16\s0 little\- oraz big-endian. Aby sprawdzić, czy
dos2unix został zbudowany z obsługą \s-1UTF\-16,\s0 należy napisać \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Pod Uniksem/Linuksem pliki w kodowaniu \s-1UTF\-16\s0 są konwertowane do kodowania
znaków ustawionej lokalizacji. Kodowanie znaków dla lokalizacji można
sprawdzić poleceniem \fIlocale\fR\|(1). Jeśli konwersja nie jest możliwa, wystąpi
błąd, a plik zostanie pominięty.
.PP
Pod Windows pliki \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8.\s0 Pliki tekstkowe
w kodowaniu \s-1UTF\-8\s0 są dobrze obsługiwane zarówno pod Windows, jak i
Uniksem/Linuksem.
.PP
Kodowania \s-1UTF\-16\s0 i \s-1UTF\-8\s0 są w pełni zgodne, konwersja nie spowoduje utraty
żadnej części tekstu. W przypadku wystąpienia błędu konwersji, na przykład w
przypadku błędu w pliku wejściowym \s-1UTF\-16,\s0 plik zostanie pominięty.
.PP
W przypadku użycia opcji \f(CW\*(C`\-u\*(C'\fR, plik wejściowy zostanie zapisany w tym samym
kodowaniu \s-1UTF\-16,\s0 co plik wejściowy. Opcja \f(CW\*(C`\-u\*(C'\fR zapobiega konwersji do
\&\s-1UTF\-8.\s0
.PP
Dos2unix oraz unix2dos nie mają opcji pozwalającej na konwersję plików \s-1UTF\-8\s0
do \s-1UTF\-16.\s0
.PP
Tryby konwersji \s-1ISO\s0 i 7\-bit nie działają na plikach \s-1UTF\-16.\s0
.SS "Znacznik \s-1BOM\s0"
.IX Subsection "Znacznik BOM"
W systemie Windows pliki tekstowe zwykle zawierają znacznik \s-1BOM \s0(Byte Order
Mark), ponieważ wiele programów dla Windows (w tym Notepad) dodaje domyślnie
znaczniki \s-1BOM.\s0 Więcej informacji można znaleźć pod adresem
<http://pl.wikipedia.org/wiki/BOM_(informatyka)>.
.PP
Pod Uniksem pliki Unicode zwykle nie mają znacznika \s-1BOM.\s0 Pliki tekstowe są
traktowane jako kodowane zgodnie z kodowaniem znaków ustawionej lokalizacji.
.PP
Dos2unix potrafi wykryć tylko, czy plik jest w formacie \s-1UTF\-16,\s0 jeśli
zawiera znacznik \s-1BOM.\s0 Jeśli plik \s-1UTF\-16\s0 nie ma tego znacznika, dos2unix
potraktuje plik jako binarny.
.PP
Do konwersji pliku \s-1UTF\-16\s0 bez znacznika \s-1BOM\s0 można użyć opcji \f(CW\*(C`\-ul\*(C'\fR lub
\&\f(CW\*(C`\-ub\*(C'\fR.
.PP
Dos2unix nie zapisuje domyślnie znaku \s-1BOM\s0 w pliku wyjściowym. Z opcją \f(CW\*(C`\-b\*(C'\fR
Dos2unix zapisuje \s-1BOM,\s0 jeśli plik wejściowy zawiera \s-1BOM.\s0
.PP
Unix2dos domyślnie zapisuje znaczniki \s-1BOM\s0 w pliku wyjściowym, jeśli plik
wejściowy ma \s-1BOM.\s0 Aby usunąć \s-1BOM,\s0 można użyć opcji \f(CW\*(C`\-r\*(C'\fR.
.PP
Dos2unix oraz unix2dos zawsze zapisują znaczniki \s-1BOM,\s0 jeśli użyta zostanie
opcja \f(CW\*(C`\-m\*(C'\fR.
.SS "Przykłady Unicode"
.IX Subsection "Przykłady Unicode"
Konwersja pliku \s-1UTF\-16 \s0(z \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Konwersja pliku \s-1UTF\-16LE \s0(bez \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-8\s0 z \s-1BOM\s0 dla Windows:
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-16\s0 dla Windows:
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 to standard urzędowy w Chinach. Obowiązkowy podzbiór standardu
\&\s-1GB18030\s0 jest oficjalnym wymaganiem każdego oprogramowania sprzedawanego w
Chinach. Więcej pod adresem <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 jest w pełni zgodny z Unicode i może być uważany za format
transformacji unikodu. Podobnie jak \s-1UTF\-8, GB18030\s0 jest zgodny z \s-1ASCII.\s0 Jest
także zgodny ze stroną kodową Windows 936, znaną też jako \s-1GBK.\s0
.PP
Pod Uniksem/Linuksem pliki \s-1UTF\-16\s0 są konwertowane do \s-1GB18030,\s0 jeśli
kodowanie dla lokalizacji jest ustawione na \s-1GB18030.\s0 Uwaga: będzie to
działać tylko dla lokalizacji chińskiej. W przypadku np. ustawienia
lokalizacji angielskiej/brytyjskiej \f(CW\*(C`en_GB.GB18030\*(C'\fR konwersja \s-1UTF\-16\s0 do
\&\s-1GB18030\s0 nie będzie działać, a dla lokalizacji chińskiej \f(CW\*(C`zh_CN.GB18030\*(C'\fR
będzie.
.PP
Pod Windows w celu konwersji plików \s-1UTF\-16\s0 do \s-1GB18030\s0 należy użyć opcji
\&\f(CW\*(C`\-gb\*(C'\fR.
.PP
Pliki w kodowaniu \s-1GB18030\s0 mogą mieć znacznik \s-1BOM,\s0 podobnie jak pliki w
Unicode.
.SH "PRZYKŁADY"
.IX Header "PRZYKŁADY"
Odczyt ze standardowego wejścia i zapis na standardowe wyjście:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja i zastąpienie b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii; konwersja i zastąpienie b.txt
w trybie 7\-bitowym:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Konwersja a.txt z formatu Mac do formatu uniksowego:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Konwersja a.txt z formatu uniksowego do formatu Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt z zachowaniem oryginalnego znacznika czasu:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt
takiego, jak a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja b.txt i zapis do e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Konwersja c.txt i zapis do e.txt; konwersja i zastąpienie a.txt; konwersja i
zastąpienie b.txt; konwersja d.txt i zapis do f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "KONWERSJA REKURENCYJNA"
.IX Header "KONWERSJA REKURENCYJNA"
Można użyć dos2unix w połączeniu z poleceniami \fIfind\fR\|(1) i \fIxargs\fR\|(1) do
rekurencyjnej konwersji plików tekstowych w strukturze drzewa katalogów. Na
przykład, aby przekonwertować wszystkie pliki .txt w drzewie katalogów
poniżej katalogu bieżącego, należy napisać:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALIZACJA"
.IX Header "LOKALIZACJA"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Główny język wybiera się zmienną środowiskową \s-1LANG.\s0 Zmienna \s-1LANG\s0 składa się
z kilku części. Pierwsza część to małe litery oznaczające kod języka. Druga
część jest opcjonalna i zawiera kod kraju pisany wielkimi literami,
poprzedzony podkreśleniem. Jest także opcjonalna trzecia część: kodowanie
znaków, poprzedzone kropką. Kilka przykładów dla powłok zgodnych ze
standardem \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl holenderski
\& export LANG=nl_NL holenderski, Holandia
\& export LANG=nl_BE holenderski, Belgia
\& export LANG=es_ES hiszpański, Hiszpania
\& export LANG=es_MX hiszpański, Meksyk
\& export LANG=en_US.iso88591 angielski, USA, kodowanie Latin\-1
\& export LANG=en_GB.UTF\-8 angielski, Wlk. Brytania, kodowanie UTF\-8
.Ve
.Sp
Pełną listę kodów języków i krajów można znaleźć w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
W systemach uniksowych do uzyskania informacji dotyczących lokalizacji można
użyć polecenia \fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Przy użyciu zmiennej środowiskowej \s-1LANGUAGE\s0 można określić listę języków wg
priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje pierwszeństwo
zmiennej \s-1LANGUAGE\s0 nad \s-1LANG.\s0 Na przykład, najpierw holenderski, następnie
niemiecki: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Aby skorzystać z listy wg priorytetów ze
zmiennej \s-1LANGUAGE,\s0 trzeba najpierw włączyć lokalizację przez ustawienie
zmiennej \s-1LANG \s0(lub \s-1LC_ALL\s0) na wartość inną niż \*(L"C\*(R". Więcej informacji
znajduje się w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
W przypadku wybrania niedostępnego języka, otrzymamy standardowe, angielskie
komunikaty.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Przy użyciu zmiennej środowiskowej \s-1DOS2UNIX_LOCALEDIR,\s0 można nadpisać
ustawienie \s-1LOCALEDIR\s0 z czasu kompilacji. \s-1LOCALEDIR\s0 to katalog używany do
znalezienia plików lokalizacji. Domyślną wartością dla \s-1GNU\s0 jest
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Opcja \fB\-\-version\fR wyświetla używaną wartość
\&\s-1LOCALEDIR.\s0
.Sp
Przykład (dla powłoki \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "WARTOŚĆ ZWRACANA"
.IX Header "WARTOŚĆ ZWRACANA"
W przypadku powodzenia zwracane jest zero. Jeśli wystąpi błąd systemowy,
zwracany jest ostatni błąd systemowy. W przypadku innych błędów zwracane
jest 1.
.PP
Wartość zwracana w trybie cichym to zawsze zero, z wyjątkiem sytuacji
podania błędnych opcji linii poleceń.
.SH "STANDARDY"
.IX Header "STANDARDY"
<http://pl.wikipedia.org/wiki/Plik_tekstowy>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://pl.wikipedia.org/wiki/End\-of\-line>
.PP
<http://pl.wikipedia.org/wiki/Unicode>
.SH "AUTORZY"
.IX Header "AUTORZY"
Benjamin Lin <blin@socs.uts.edu.au>; Bernd Johannes Wuebben (tryb mac2unix)
<wuebben@kde.org>; Christian Wurll (dodawanie dodatkowej nowej linii)
<wurll@ira.uka.de>; Erwin Waterlander <waterlan@xs4all.nl> (prowadzący)
.PP
Strona projektu: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Strona SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ZOBACZ TAKŻE"
.IX Header "ZOBACZ TAKŻE"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,756 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAZWA"
.IX Header "NAZWA"
dos2unix \- konwerter formatu plików tekstowych między systemami DOS/Mac a
Uniksem
.SH "SKŁADNIA"
.IX Header "SKŁADNIA"
.Vb 2
\& dos2unix [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
\& unix2dos [opcje] [PLIK ...] [\-n PLIK_WEJ PLIK_WYJ ...]
.Ve
.SH "OPIS"
.IX Header "OPIS"
Pakiet Dos2unix zawiera narzędzia \f(CW\*(C`dos2unix\*(C'\fR oraz \f(CW\*(C`unix2dos\*(C'\fR do konwersji
zwykłych plików tekstowych między formatami używanymi w systemach \s-1DOS\s0 lub
Mac a formatem uniksowym.
.PP
W plikach tekstowych systemu DOS/Windows oznaczenie końca linii to
połączenie dwóch znaków: powrotu karetki (\s-1CR\s0) i przesunięcia linii (\s-1LF\s0). W
uniksowych plikach tekstowych koniec linii to pojedynczy znak \s-1LF. W\s0 plikach
tekstowych systemu Mac sprzed Mac \s-1OS X\s0 koniec linii był pojedynczym znakiem
\&\s-1CR.\s0 Obecnie Mac \s-1OS\s0 wykorzystuje uniksowe końce linii (\s-1LF\s0).
.PP
Oprócz oznaczeń końców linii Dos2unix potrafi konwertować także kodowanie
plików. Kilko stron kodowych DOS-a może być przekonwertowanych do uniksowego
Latin\-1, a windowsowy Unicode (\s-1UTF\-16\s0) do powszechniejszego pod Uniksem
kodowania Unicode \s-1UTF\-8.\s0
.PP
Pliki binarne są pomijane automatycznie, chyba że konwersja zostanie
wymuszona.
.PP
Pliki inne niż zwykłe, np. katalogi lub \s-1FIFO,\s0 są pomijane automatycznie.
.PP
Dowiązania symboliczne i ich cele są domyślnie pozostawiane bez
zmian. Dowiązania symboliczne mogą być opcjonalnie zastępowane, albo wyjście
może być zapisywane do celu dowiązania. Zapis do celu dowiązania
symbolicznego nie jest obsługiwane pod Windows.
.PP
Dos2unix powstał na podstawie narzędzia dos2unix z systemu
SunOS/Solaris. Jest jedna istotna różnica w stosunku do oryginalnej wersji z
SunOS\-a/Solarisa: ta wersja domyślnie wykonuje konwersję w miejscu (tryb
starego pliku), podczas gdy oryginalna obsługiwała tylko konwersję parami
(tryb nowego pliku) \- p. także opcje \f(CW\*(C`\-o\*(C'\fR i \f(CW\*(C`\-n\*(C'\fR.
.SH "OPCJE"
.IX Header "OPCJE"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Potraktowanie wszystkich kolejnych opcji jako nazw plików. Tej opcji należy
użyć, aby przekonwertować pliki, których nazwy zaczynają się od
minusa. Przykładowo, aby przekonwertować plik o nazwie \*(L"\-foo\*(R", można użyć
polecenia:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Lub w trybie nowego pliku:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Konwersja tylko znaków końca linii. Jest to domyślny tryb konwersji.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Konwersja między zestawami znaków \s-1DOS\s0 i \s-1ISO\-8859\-1.\s0 Więcej w sekcji \s-1TRYBY
KONWERSJI.\s0
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Użycie strony kodowej Windows 1252 (zachodnioeuropejskiej).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Użycie strony kodowej \s-1DOS 437 \s0(\s-1US\s0). Jest to domyślna strona kodowa używana
przy konwersji \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Użycie strony kodowej \s-1DOS 850 \s0(zachodnioeuropejskiej).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Użycie strony kodowej \s-1DOS 860 \s0(portugalskiej).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Użycie strony kodowej \s-1DOS 863 \s0(kanadyjskiej francuskiej).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Użycie strony kodowej \s-1DOS 865 \s0(nordyckiej).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Konwersja znaków 8\-bitowych do przestrzeni 7\-bitowej.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Zachowanie znaku \s-1BOM \s0(Byte Order Makr). Jeżeli plik wejściowy zawiera \s-1BOM,\s0
powoduje zapisanie go w pliku wyjściowym. Jest to domyślne zachowanie przy
konwersji na DOS-owe końce linii. P. także opcja \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1TRYB_KONW\s0\fR" 4
.IX Item "-c, --convmode TRYB_KONW"
Ustawienie trybu konwersji. \s-1TRYB_KONW\s0 to jeden z: \fIascii\fR, \fI7bit\fR, \fIiso\fR,
\&\fImac\fR, przy czym domyślny jest ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Wymuszenie konwersji plików binarnych.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
Pod Windows pliki w \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8,\s0 niezależnie
od ustawienia lokalizacji. Ta opcja pozwala przekonwertować pliki w \s-1UTF\-16\s0
do \s-1GB18030.\s0 Opcja jest dostępna tylko pod Windows, więcej w sekcji
dotyczącej \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Wyświetlenie opisu i zakończenie.
.IP "\fB\-i[\s-1FLAGI\s0], \-\-info[=FLAGI] \s-1PLIK ...\s0\fR" 4
.IX Item "-i[FLAGI], --info[=FLAGI] PLIK ..."
Wyświetlenie informacji o pliku. Konwersja nie jest wykonywana.
.Sp
Wypisywane są następujące informacje, w tej kolejności: liczba DOS-owych
końców linii, liczba uniksowych końców linii, liczba macowych końców linii,
znacznik \s-1BOM,\s0 tekstowy lub binarny, nazwa pliku.
.Sp
Przykładowe wyjście:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcjonalnie można ustawić dodatkowe flagi, aby zmienić wyjście. Można dodać
jedną lub więcej flag.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Wypisanie liczby DOS-owych końców linii.
.IP "\fBu\fR" 4
.IX Item "u"
Wypisanie liczby uniksowych końców linii.
.IP "\fBm\fR" 4
.IX Item "m"
Wypisanie liczby macowych końców linii.
.IP "\fBb\fR" 4
.IX Item "b"
Wypisanie znacznika \s-1BOM.\s0
.IP "\fBt\fR" 4
.IX Item "t"
Wypisanie, czy plik jest tekstowy, czy binarny.
.IP "\fBc\fR" 4
.IX Item "c"
Wypisanie tylko plików, które zostałyby przekonwertowane.
.Sp
Z flagą \f(CW\*(C`c\*(C'\fR dos2unix wypisze tylko pliki zawierające DOS-owe końce linii, a
unix2dos wypisze tylko nazwy plików zawierających uniksowe końce linii.
.RE
.RS 4
.Sp
Przykłady:
.Sp
Pokazanie informacji o wszystkich plikach *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Pokazanie tylko liczby DOS-owych i uniksowych końców linii:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Pokazanie tylko znacznika \s-1BOM:\s0
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Wypisanie listy plików zawierających DOS-owe końce linii:
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Wypisanie listy plików zawierających uniksowe końce linii:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Zachowanie znacznika czasu pliku wyjściowego takiego samego, jak pliku
wejściowego.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Wyświetlenie licencji programu.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Dodanie dodatkowego znaku końca linii.
.Sp
\&\fBdos2unix\fR: tylko DOS-owe znaki końca linii są zamieniane na dwa
uniksowe. W trybie Mac tylko macowe znaki końca linii są zamieniane na dwa
uniksowe.
.Sp
\&\fBunix2dos\fR: tylko uniksowe znaki końca linii są zamieniane na dwa
DOS-owe. W trybie Mac uniksowe znaki końca linii są zamieniane na dwa
macowe.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Zapisanie znacznika \s-1BOM \s0(Byte Order Mark) w pliku wyjściowym. Domyślnie
zapisywany jest \s-1BOM UTF\-8.\s0
.Sp
Jeśli plik wejściowy jest w kodowaniu \s-1UTF\-16\s0 i użyto opcji \f(CW\*(C`\-u\*(C'\fR, zostanie
zapisany \s-1BOM UTF\-16.\s0
.Sp
Nigdy nie należy używać tej opcji, jeśli kodowanie wyjściowe jest inne niż
\&\s-1UTF\-8\s0 lub \s-1UTF\-16.\s0 Więcej w sekcji \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1PLIK_WEJ PLIK_WYJ ...\s0\fR" 4
.IX Item "-n, --newfile PLIK_WEJ PLIK_WYJ ..."
Tryb nowego pliku. Konwersja \s-1PLIKU_WEJ\s0 z zapisem wyjścia do \s-1PLIKU_WYJ.\s0 Nazwy
plików muszą być podane parami, a masek \fInie\fR należy używać, gdyż
\&\fIspowoduje\fR to utratę plików.
.Sp
Osoba uruchamiająca konwersję w trybie nowego pliku (par) będzie
właścicielem przekonwertowanego pliku. Prawa odczytu/zapisu nowego pliku
będą pochodziły z praw pliku oryginalnego po odjęciu \fIumask\fR\|(1) osoby
uruchamiającej konwersję.
.IP "\fB\-o, \-\-oldfile \s-1PLIK ...\s0\fR" 4
.IX Item "-o, --oldfile PLIK ..."
Tryb starego pliku. Konwersja \s-1PLIKU\s0 i nadpisanie go wyjściem. Program działa
domyślnie w tym trybie. Można używać masek.
.Sp
W trybie starego pliku (w miejscu) przekonwertowany plik otrzymuje tego
samego właściciela, grupę oraz prawa odczytu/zapisu, jak plik oryginalny \-
także wtedy, gdy plik jest konwertowany przez innego użytkownika, mającego
prawo zapisu do pliku (np. przez użytkownika root). Konwersja zostanie
przerwana, jeśli nie będzie możliwe zachowanie oryginalnych wartości. Zmiana
właściciela mogłaby oznaczać, że pierwotny właściciel nie może już odczytać
pliku. Zmiana grupy mogłaby być zagrożeniem bezpieczeństwa, plik mógłby być
czytelny dla nie zamierzonych osób. Zachowanie właściciela, grupy i praw
odczytu/zapisu jest obsługiwane tylko na Uniksie.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Tryb cichy. Pominięcie wszystkich ostrzeżeń i komunikatów. Zwracanym kodem
jest zero, chyba że podano błędne opcje linii poleceń.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Usunięcie znaków \s-1BOM \s0(Byte Order Mark). Bez zapisywania \s-1BOM\s0 do pliku
wyjściowego. Jest to domyślne zachowanie przy konwersji na uniksowe końce
linii. P. także opcja \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Pominięcie plików binarnych (domyślne).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Zachowanie oryginalnego kodowania pliku wejściowego \s-1UTF\-16.\s0 Plik wyjściowy
zostanie zapisany w tym samym kodowaniu \s-1UTF\-16 \s0(little lub big endian), co
plik wejściowy. Zapobiega to przekształceniu do \s-1UTF\-8.\s0 Do pliku zostanie
zapisany odpowiedni znacznik \s-1BOM UTF\-16.\s0 Tę opcję można wyłączyć opcją
\&\f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16LE.\s0
.Sp
Jeśli w pliku wejściowym jest znacznik \s-1BOM \s0(Byte Order Mark), ma on
priorytet nad tą opcją.
.Sp
Jeśli przyjęto błędne założenie (plik wejściowy nie jest w formacie
\&\s-1UTF\-16LE\s0), a konwersja się uda, wynikiem będzie plik wyjściowy \s-1UTF\-8\s0 ze złym
tekstem. Konwersję tę można odwrócić przy użyciu polecenia \fIiconv\fR\|(1) do
konwersji wyjścia \s-1UTF\-8\s0 z powrotem do \s-1UTF\-16LE.\s0 Przywróci to plik
oryginalny.
.Sp
Przyjęcie \s-1UTF\-16LE\s0 działa jako \fItryb konwersji\fR. Przy przełączeniu na
domyślny tryb \fIascii\fR przyjęcie \s-1UTF\-16LE\s0 jest wyłączane.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Przyjęcie, że format pliku wejściowego to \s-1UTF\-16BE.\s0
.Sp
Ta opcja działa analogicznie do \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Wyświetlanie szczegółowych komunikatów. Wyświetlane śa dodatkowe informacje
o znacznikach \s-1BOM \s0(Byte Order Mark) oraz liczbie przekonwertowanych końców
linii.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Podążanie za dowiązaniami symbolicznymi i konwertowanie ich celów
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Zastępowanie dowiązań symbolicznych przekonwertowanymi plikami (oryginalne
pliki docelowe pozostają bez zmian).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Pozostawienie dowiązań symbolicznych i celów bez zmian (domyślne).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Wyświetlenie informacji o wersji i zakończenie.
.SH "TRYB MAC"
.IX Header "TRYB MAC"
W zwykłym trybie znaki końca linii są konwertowane z DOS-a do Uniksa i
odwrotnie. Znaki końca linii systemu Mac nie są konwertowane.
.PP
W trybie Mac znaki końca linii są konwertowane z formatu Maca do Uniksa i
odwrotnie. Znaki końca linii systemu \s-1DOS\s0 nie są zmieniane.
.PP
Aby uruchomić program w trybie Mac, należy użyć opcji linii poleceń \f(CW\*(C`\-c
mac\*(C'\fR albo użyć poleceń \f(CW\*(C`mac2unix\*(C'\fR lub \f(CW\*(C`unix2mac\*(C'\fR.
.SH "TRYBY KONWERSJI"
.IX Header "TRYBY KONWERSJI"
.IP "\fBascii\fR" 4
.IX Item "ascii"
W trybie \f(CW\*(C`ascii\*(C'\fR konwertowane są tylko końce linii. Jest to domyślny tryb
konwersji.
.Sp
Mimo że nazwa tego trybu to \s-1ASCII,\s0 które jest standardem 7\-bitowym, jest to
tryb 8\-bitowy. Należy zawsze używać tego trybu przy konwersji plików Unicode
\&\s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
W tym trybie wszystkie znaki 8\-bitowe spoza \s-1ASCII \s0(o wartościach od 128 do
255) są konwertowane do przestrzeni 7\-bitowej.
.IP "\fBiso\fR" 4
.IX Item "iso"
W tym trybie znaki są konwertowane między zestawem znaków \s-1DOS \s0(stroną
kodową) a zestawem znaków \s-1ISO\-8859\-1 \s0(Latin\-1) używanym na Uniksie. Znaki
DOS-owe nie mające odpowiednika w \s-1ISO\-8859\-1,\s0 których nie da się
przekonwertować, są zamieniane na kropkę. To samo dotyczy znaków \s-1ISO\-8859\-1\s0
bez odpowiednika w DOS-ie.
.Sp
Jeśli używana jest tylko opcja \f(CW\*(C`\-iso\*(C'\fR, dos2unix próbuje wykryć aktywną
stronę kodową. Jeśli nie jest to możliwe, dos2unix używa domyślnej strony
kodowej \s-1CP437,\s0 stosowanej głównie w \s-1USA.\s0 Aby wymusić określoną stronę
kodową, należy użyć opcji \f(CW\*(C`\-437\*(C'\fR (\s-1US\s0), \f(CW\*(C`\-850\*(C'\fR (zachodnioeuropejska),
\&\f(CW\*(C`\-860\*(C'\fR (portugalska), \f(CW\*(C`\-863\*(C'\fR (kanadyjska francuska) lub \f(CW\*(C`\-865\*(C'\fR
(nordycka). Ponadto obsługiwana jest strona kodowa Windows \s-1CP1252
\&\s0(zachodnioeuropejska) przy użyciu opcji \f(CW\*(C`\-1252\*(C'\fR. W przypadku innych stron
kodowych można użyć narzędzia dos2unix wraz z \fIiconv\fR\|(1). Iconv potrafi
konwertować między wieloma kodowaniami znaków.
.Sp
Nigdy nie należy używać konwersji \s-1ISO\s0 na plikach tekstowych w
Unicode. Uszkodziłaby pliki kodowane \s-1UTF\-8.\s0
.Sp
Kilka przykładów:
.Sp
Konwersja z domyślnej strony kodowej \s-1DOS\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej \s-1DOS CP850\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego Latin\-1:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja ze strony kodowej Windows \s-1CP1252\s0 do uniksowego \s-1UTF\-8 \s0(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Konwersa z uniksowego Latin\-1 do domyślnej strony kodowej \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego Latin\-1 do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Konwersja z uniksowego \s-1UTF\-8 \s0(Unicode) do strony kodowej Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Więcej pod adresem <http://czyborra.com/charsets/codepages.html> oraz
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Kodowania"
.IX Subsection "Kodowania"
Istnieją różne kodowania Unicode. Pod Uniksem i Linuksem pliki Unicode są
zwykle kodowane z użyciem \s-1UTF\-8.\s0 Pod Windows pliki tekstowe Unicode mogą być
kodowane w \s-1UTF\-8, UTF\-16, UTF\-16\s0 big-endian, ale przeważnie są kodowane w
\&\s-1UTF\-16.\s0
.SS "Konwersje"
.IX Subsection "Konwersje"
Pliki tekstowe Unicode mogą mieć znaki końca linii systemu \s-1DOS,\s0 Unix lub
Mac, podobnie jak zwykłe pliki tekstowe.
.PP
Wszystkie wersje dos2unix i unix2dos potrafią konwertować pliki kodowane
\&\s-1UTF\-8,\s0 ponieważ \s-1UTF\-8\s0 jest wstecznie zgodne z \s-1ASCII.\s0
.PP
Dos2unix i unix2dos z obsługą Unicode \s-1UTF\-16\s0 potrafią odczytywać pliki
tekstowe kodowane \s-1UTF\-16\s0 little\- oraz big-endian. Aby sprawdzić, czy
dos2unix został zbudowany z obsługą \s-1UTF\-16,\s0 należy napisać \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
Pod Uniksem/Linuksem pliki w kodowaniu \s-1UTF\-16\s0 są konwertowane do kodowania
znaków ustawionej lokalizacji. Kodowanie znaków dla lokalizacji można
sprawdzić poleceniem \fIlocale\fR\|(1). Jeśli konwersja nie jest możliwa, wystąpi
błąd, a plik zostanie pominięty.
.PP
Pod Windows pliki \s-1UTF\-16\s0 są domyślnie konwertowane do \s-1UTF\-8.\s0 Pliki tekstkowe
w kodowaniu \s-1UTF\-8\s0 są dobrze obsługiwane zarówno pod Windows, jak i
Uniksem/Linuksem.
.PP
Kodowania \s-1UTF\-16\s0 i \s-1UTF\-8\s0 są w pełni zgodne, konwersja nie spowoduje utraty
żadnej części tekstu. W przypadku wystąpienia błędu konwersji, na przykład w
przypadku błędu w pliku wejściowym \s-1UTF\-16,\s0 plik zostanie pominięty.
.PP
W przypadku użycia opcji \f(CW\*(C`\-u\*(C'\fR, plik wejściowy zostanie zapisany w tym samym
kodowaniu \s-1UTF\-16,\s0 co plik wejściowy. Opcja \f(CW\*(C`\-u\*(C'\fR zapobiega konwersji do
\&\s-1UTF\-8.\s0
.PP
Dos2unix oraz unix2dos nie mają opcji pozwalającej na konwersję plików \s-1UTF\-8\s0
do \s-1UTF\-16.\s0
.PP
Tryby konwersji \s-1ISO\s0 i 7\-bit nie działają na plikach \s-1UTF\-16.\s0
.SS "Znacznik \s-1BOM\s0"
.IX Subsection "Znacznik BOM"
W systemie Windows pliki tekstowe zwykle zawierają znacznik \s-1BOM \s0(Byte Order
Mark), ponieważ wiele programów dla Windows (w tym Notepad) dodaje domyślnie
znaczniki \s-1BOM.\s0 Więcej informacji można znaleźć pod adresem
<http://pl.wikipedia.org/wiki/BOM_(informatyka)>.
.PP
Pod Uniksem pliki Unicode zwykle nie mają znacznika \s-1BOM.\s0 Pliki tekstowe są
traktowane jako kodowane zgodnie z kodowaniem znaków ustawionej lokalizacji.
.PP
Dos2unix potrafi wykryć tylko, czy plik jest w formacie \s-1UTF\-16,\s0 jeśli
zawiera znacznik \s-1BOM.\s0 Jeśli plik \s-1UTF\-16\s0 nie ma tego znacznika, dos2unix
potraktuje plik jako binarny.
.PP
Do konwersji pliku \s-1UTF\-16\s0 bez znacznika \s-1BOM\s0 można użyć opcji \f(CW\*(C`\-ul\*(C'\fR lub
\&\f(CW\*(C`\-ub\*(C'\fR.
.PP
Dos2unix nie zapisuje domyślnie znaku \s-1BOM\s0 w pliku wyjściowym. Z opcją \f(CW\*(C`\-b\*(C'\fR
Dos2unix zapisuje \s-1BOM,\s0 jeśli plik wejściowy zawiera \s-1BOM.\s0
.PP
Unix2dos domyślnie zapisuje znaczniki \s-1BOM\s0 w pliku wyjściowym, jeśli plik
wejściowy ma \s-1BOM.\s0 Aby usunąć \s-1BOM,\s0 można użyć opcji \f(CW\*(C`\-r\*(C'\fR.
.PP
Dos2unix oraz unix2dos zawsze zapisują znaczniki \s-1BOM,\s0 jeśli użyta zostanie
opcja \f(CW\*(C`\-m\*(C'\fR.
.SS "Przykłady Unicode"
.IX Subsection "Przykłady Unicode"
Konwersja pliku \s-1UTF\-16 \s0(z \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Konwersja pliku \s-1UTF\-16LE \s0(bez \s-1BOM\s0) z formatu Windows do uniksowego \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-8\s0 z \s-1BOM\s0 dla Windows:
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Konwersja z uniksowego \s-1UTF\-8\s0 do \s-1UTF\-16\s0 dla Windows:
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 to standard urzędowy w Chinach. Obowiązkowy podzbiór standardu
\&\s-1GB18030\s0 jest oficjalnym wymaganiem każdego oprogramowania sprzedawanego w
Chinach. Więcej pod adresem <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 jest w pełni zgodny z Unicode i może być uważany za format
transformacji unikodu. Podobnie jak \s-1UTF\-8, GB18030\s0 jest zgodny z \s-1ASCII.\s0 Jest
także zgodny ze stroną kodową Windows 936, znaną też jako \s-1GBK.\s0
.PP
Pod Uniksem/Linuksem pliki \s-1UTF\-16\s0 są konwertowane do \s-1GB18030,\s0 jeśli
kodowanie dla lokalizacji jest ustawione na \s-1GB18030.\s0 Uwaga: będzie to
działać tylko dla lokalizacji chińskiej. W przypadku np. ustawienia
lokalizacji angielskiej/brytyjskiej \f(CW\*(C`en_GB.GB18030\*(C'\fR konwersja \s-1UTF\-16\s0 do
\&\s-1GB18030\s0 nie będzie działać, a dla lokalizacji chińskiej \f(CW\*(C`zh_CN.GB18030\*(C'\fR
będzie.
.PP
Pod Windows w celu konwersji plików \s-1UTF\-16\s0 do \s-1GB18030\s0 należy użyć opcji
\&\f(CW\*(C`\-gb\*(C'\fR.
.PP
Pliki w kodowaniu \s-1GB18030\s0 mogą mieć znacznik \s-1BOM,\s0 podobnie jak pliki w
Unicode.
.SH "PRZYKŁADY"
.IX Header "PRZYKŁADY"
Odczyt ze standardowego wejścia i zapis na standardowe wyjście:
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja i zastąpienie b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt w trybie ascii; konwersja i zastąpienie b.txt
w trybie 7\-bitowym:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Konwersja a.txt z formatu Mac do formatu uniksowego:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Konwersja a.txt z formatu uniksowego do formatu Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Konwersja i zastąpienie a.txt z zachowaniem oryginalnego znacznika czasu:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Konwersja a.txt i zapis do e.txt z zachowaniem znacznika czasu e.txt
takiego, jak a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Konwersja i zastąpienie a.txt; konwersja b.txt i zapis do e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Konwersja c.txt i zapis do e.txt; konwersja i zastąpienie a.txt; konwersja i
zastąpienie b.txt; konwersja d.txt i zapis do f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "KONWERSJA REKURENCYJNA"
.IX Header "KONWERSJA REKURENCYJNA"
Można użyć dos2unix w połączeniu z poleceniami \fIfind\fR\|(1) i \fIxargs\fR\|(1) do
rekurencyjnej konwersji plików tekstowych w strukturze drzewa katalogów. Na
przykład, aby przekonwertować wszystkie pliki .txt w drzewie katalogów
poniżej katalogu bieżącego, należy napisać:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOKALIZACJA"
.IX Header "LOKALIZACJA"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Główny język wybiera się zmienną środowiskową \s-1LANG.\s0 Zmienna \s-1LANG\s0 składa się
z kilku części. Pierwsza część to małe litery oznaczające kod języka. Druga
część jest opcjonalna i zawiera kod kraju pisany wielkimi literami,
poprzedzony podkreśleniem. Jest także opcjonalna trzecia część: kodowanie
znaków, poprzedzone kropką. Kilka przykładów dla powłok zgodnych ze
standardem \s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl holenderski
\& export LANG=nl_NL holenderski, Holandia
\& export LANG=nl_BE holenderski, Belgia
\& export LANG=es_ES hiszpański, Hiszpania
\& export LANG=es_MX hiszpański, Meksyk
\& export LANG=en_US.iso88591 angielski, USA, kodowanie Latin\-1
\& export LANG=en_GB.UTF\-8 angielski, Wlk. Brytania, kodowanie UTF\-8
.Ve
.Sp
Pełną listę kodów języków i krajów można znaleźć w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
W systemach uniksowych do uzyskania informacji dotyczących lokalizacji można
użyć polecenia \fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Przy użyciu zmiennej środowiskowej \s-1LANGUAGE\s0 można określić listę języków wg
priorytetu, oddzielonych dwukropkami. Dos2unix przyjmuje pierwszeństwo
zmiennej \s-1LANGUAGE\s0 nad \s-1LANG.\s0 Na przykład, najpierw holenderski, następnie
niemiecki: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Aby skorzystać z listy wg priorytetów ze
zmiennej \s-1LANGUAGE,\s0 trzeba najpierw włączyć lokalizację przez ustawienie
zmiennej \s-1LANG \s0(lub \s-1LC_ALL\s0) na wartość inną niż \*(L"C\*(R". Więcej informacji
znajduje się w podręczniku do gettexta:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
W przypadku wybrania niedostępnego języka, otrzymamy standardowe, angielskie
komunikaty.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Przy użyciu zmiennej środowiskowej \s-1DOS2UNIX_LOCALEDIR,\s0 można nadpisać
ustawienie \s-1LOCALEDIR\s0 z czasu kompilacji. \s-1LOCALEDIR\s0 to katalog używany do
znalezienia plików lokalizacji. Domyślną wartością dla \s-1GNU\s0 jest
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Opcja \fB\-\-version\fR wyświetla używaną wartość
\&\s-1LOCALEDIR.\s0
.Sp
Przykład (dla powłoki \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "WARTOŚĆ ZWRACANA"
.IX Header "WARTOŚĆ ZWRACANA"
W przypadku powodzenia zwracane jest zero. Jeśli wystąpi błąd systemowy,
zwracany jest ostatni błąd systemowy. W przypadku innych błędów zwracane
jest 1.
.PP
Wartość zwracana w trybie cichym to zawsze zero, z wyjątkiem sytuacji
podania błędnych opcji linii poleceń.
.SH "STANDARDY"
.IX Header "STANDARDY"
<http://pl.wikipedia.org/wiki/Plik_tekstowy>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://pl.wikipedia.org/wiki/End\-of\-line>
.PP
<http://pl.wikipedia.org/wiki/Unicode>
.SH "AUTORZY"
.IX Header "AUTORZY"
Benjamin Lin <blin@socs.uts.edu.au>; Bernd Johannes Wuebben (tryb mac2unix)
<wuebben@kde.org>; Christian Wurll (dodawanie dodatkowej nowej linii)
<wurll@ira.uka.de>; Erwin Waterlander <waterlan@xs4all.nl> (prowadzący)
.PP
Strona projektu: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Strona SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ZOBACZ TAKŻE"
.IX Header "ZOBACZ TAKŻE"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,754 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOME"
.IX Header "NOME"
dos2unix \- Conversor de formato de arquivo texto de DOS/Mac para Unix e
vice-versa
.SH "SINOPSE"
.IX Header "SINOPSE"
.Vb 2
\& dos2unix [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
\& unix2dos [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
.Ve
.SH "DESCRIÇÃO"
.IX Header "DESCRIÇÃO"
O pacote Dos2unix inclui utilitários de \f(CW\*(C`dos2unix\*(C'\fR e \f(CW\*(C`unix2dos\*(C'\fR para
converter arquivos texto nos formatos \s-1DOS\s0 ou Mac para formato Unix e
vice-versa.
.PP
Em arquivos texto DOS/Windows uma quebra de linha, também conhecida como
nova linha, é uma combinação de dois caracteres: um Carriage Return (\s-1CR\s0)
seguido por um Line Feed (\s-1LF\s0). Em arquivos texto do Unix uma quebra de linha
é um único caractere: o Line Feed (\s-1LF\s0). Em arquivos texto do Mac, anteriores
ao Mac \s-1OS X,\s0 uma quebra de linha era um único caractere Carriage Return
(\s-1CR\s0). Hoje em dia, Mac \s-1OS\s0 usa quebras de linha no estilo do Unix (\s-1LF\s0).
.PP
Além das quebras de linhas, Dos2unix também pode converter as codificações
de arquivos. Algumas poucas páginas podem ser convertidos para Latin\-1 para
Unix. E arquivos Unicode do Windows (\s-1UTF\-16\s0) podem ser convertidos para
arquivos Unicode do Unix (\s-1UTF\-8\s0).
.PP
Arquivos binários são ignorados automaticamente, a menos que a conversão
seja forçada.
.PP
Arquivos não regulares, tais como diretórios e FIFOs, são ignorados
automaticamente.
.PP
Ligações simbólicas e seus alvos são por padrão mantidas
intocáveis. Ligações simbólicas podem opcionalmente ser substituídas, ou a
saída pode ser escrita para o alvo das ligações simbólicas. Não há suporte
às ligações simbólicas do Windows.
.PP
Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. Há uma diferença
importante em relação à versão original do SunOS/Solaris. Essa versão faz
conversão no-lugar (modo arquivo antigo) por padrão, enquanto a versão
original do SunOS/Solaris fornecia suporte apenas a conversão pareada (modo
de novo arquivo). Veja também as opções \f(CW\*(C`\-o\*(C'\fR e \f(CW\*(C`\-n\*(C'\fR.
.SH "OPÇÕES"
.IX Header "OPÇÕES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Trata as opções seguintes como nomes de arquivos. Use essa opção se você
quiser converter arquivos cujos nomes iniciam com um traço. Por exemplo,
para converter um arquivo chamado \*(L"foo\*(R", você pode usar este comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou em modo de novo arquivo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo saída.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Converte apenas as quebras de linhas. Esse é o modo de conversão padrão.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversão entre conjunto de caractere do \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Veja também a
seção \s-1MODOS DE\s0 CONVERSÃO.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa a página de código 1252 do Windows (Europa ocidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa a página de código 437 do \s-1DOS \s0(\s-1EUA\s0). Essa é a página de código padrão
usada para conversão \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa a página de código 850 do \s-1DOS \s0(Europa ocidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa a página de código 860 do \s-1DOS \s0(Português).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa a página de código 863 do \s-1DOS \s0(Francês do Canadá).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa a página de código 865 do \s-1DOS \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Converte caracteres de 8 bit para espaço de 7 bit.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantém marca de ordem de bytes (\s-1BOM\s0). Quando o arquivo de entrada possuir um
\&\s-1BOM,\s0 escreve um \s-1BOM\s0 no arquivo de saída. Esse é o comportamento padrão ao
converter para quebras de linha do \s-1DOS.\s0 Veja também a opção \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODOCONV\s0\fR" 4
.IX Item "-c, --convmode MODOCONV"
Define o modo de conversão, sendo \s-1MODOCONV\s0 um dentre: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, \fImac\fR com ascii sendo o padrão.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Força a conversão de arquivos binários.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para \s-1UTF\-8,\s0
independentemente da localização definida. Use esta opção para converter
arquivos \s-1UTF\-16\s0 para \s-1GB18030.\s0 Essa opção está disponível apenas no
Windows. Veja também a seção \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Exibe ajuda e sai.
.IP "\fB\-i[OPÇÕES], \-\-info[=OPÇÕES] \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-i[OPÇÕES], --info[=OPÇÕES] ARQUIVO ..."
Exibe informação do arquivo. Nenhuma conversão é feita.
.Sp
A seguinte informação é exibida, nesta ordem: número de quebras de linha do
\&\s-1DOS,\s0 número de quebras de linha do Unix, número de quebras de linha do Mac,
marca de ordem de byte, \*(L"text\*(R" ou \*(L"binário\*(R", nome de arquivo.
.Sp
Saída de exemplo:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcionalmente, opções extra podem ser definidas para alterar a saída. Uma ou
mais opções podem ser adicionadas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Exibe o número de quebras de linhas do \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Exibe o número de quebras de linhas do Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Exibe o número de quebras de linhas do Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Exibe a marca de ordem de byte.
.IP "\fBt\fR" 4
.IX Item "t"
Exibe se arquivo é texto ou binário.
.IP "\fBc\fR" 4
.IX Item "c"
Exib apenas os arquivos que seriam convertidos.
.Sp
Com a opção \f(CW\*(C`c\*(C'\fR, dos2unix vai exibir apenas os arquivos que contêm quebras
de linha do \s-1DOS,\s0 unix2dos vai exibir apenas os nomes de arquivos que contêm
quebras de linha do Unix.
.RE
.RS 4
.Sp
Exemplos:
.Sp
Mostra informação sobre todos os arquivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Mostra apenas o número de quebras de linha \s-1DOS\s0 e Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Mostra apenas a marca de ordem de byte:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantém a marca da data do arquivo de saída igual ao do arquivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Exibe a licença do programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Adiciona nova linha adicional.
.Sp
\&\fBdos2unix\fR: Apenas quebras de linha do \s-1DOS\s0 são alteradas para duas quebras
de linha do Unix. No modo Mac, apenas quebras de linha do Mac são alterados
para duas quebras de linha do Unix.
.Sp
\&\fBunix2dos\fR: Apenas quebras de linha do Unix são alteradas para duas quebras
de linha do \s-1DOS.\s0 No modo Mac, quebras de linha do Unix são alteradas para
duas quebras de linha do Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escreve uma marca de ordem de byte (\s-1BOM\s0) no arquivo de saída. Por padrão, um
\&\s-1BOM UTF\-8\s0 é escrito.
.Sp
Quando o arquivo de entrada é \s-1UTF\-16,\s0 e a opção \f(CW\*(C`\-u\*(C'\fR é usada, um \s-1BOM UTF\-16\s0
será escrito.
.Sp
Nunca use essa opção quando a codificação de saída é outra além de \s-1UTF\-8\s0 ou
\&\s-1UTF\-16.\s0 Veja também a seção \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARQENT\s0 ARQSAÍDA ...\fR" 4
.IX Item "-n, --newfile ARQENT ARQSAÍDA ..."
Modo de novo arquivo. Converte o arquivo \s-1ARQENT\s0 e escreve a saída para o
arquivo ARQSAÍDA. Os nomes de arquivos devem ser fornecidos em pares e nome
coringa \fInão\fR deveriam ser usados ou você \fIvai\fR perder seus arquivos.
.Sp
A pessoa que começa a conversão em modo novo arquivo (pareado) será o dono
do arquivo convertido. As permissões de leitura/escrita do novo arquivo
serão as permissões do arquivo original menos a \fIumask\fR\|(1) da pessoa que
executa a conversão.
.IP "\fB\-o, \-\-oldfile \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARQUIVO ..."
Modo arquivo antigo. Converte o arquivo \s-1ARQUIVO\s0 e o sobrescreve com a
saída. O programa, por padrão, executa neste modo. Nomes coringas podem ser
usados.
.Sp
No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no mesmo
dono, grupo e permissões de leitura/escrita que o arquivo original. Também,
quando o arquivo é convertido por outro usuário que tenha permissões de
escrita no arquivo (ex.: usuário root). A conversão será abortada quando não
for possível preservar os valores originais. Alteração do dono pode
significar que o dono original não é mais capaz de ler o arquivo. Alteração
do grupo pode ser um risco para a segurança, pois o arquivo pode ficar
legível para pessoas cujo acesso não é desejado. Preservação do dono, grupo
e permissões de leitura/escrita tem suporte apenas no Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo quieto. Suprime todos os avios e mensagens. O valor retornado é
zero. Exceto quando opções de linha de comando erradas forem usadas.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
remove marca de ordem de bytes (\s-1BOM\s0). Não escreve um \s-1BOM\s0 no arquivo de
saída. Esse é o comportamento padrão ao converter para quebras de linha
Unix. Veja também a opção \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora arquivo binários (padrão).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantém a codificação \s-1UTF\-16\s0 original do arquivo de entrada. O arquivo de
saída será escrito na mesma codificação \s-1UTF\-16,\s0 em little ou big endian,
como o arquivo de entrada. Isso evita transformação para \s-1UTF\-8.\s0 Como
consequência, um \s-1BOM UTF\-16\s0 será escrito. Essa opção pode ser desabilitada
com a opção \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Presume que o formato de arquivo de entrada é \s-1UTF\-16LE.\s0
.Sp
Quando há uma marca de ordem de byte no arquivo de entrada, esta tem
prioridade sobre essa opção.
.Sp
Quando você fizer uma presunção equivocada (o arquivo de entrada não estava
no formato \s-1UTF\-16LE\s0) e a conversão funcionar, você terá um arquivo de saída
\&\s-1UTF\-8\s0 com texto errado. Você pode desfazer a conversão errada com \fIiconv\fR\|(1)
pela conversão do arquivo de saída \s-1UTF\-8\s0 de volta para \s-1UTF\-16LE.\s0 Isso vai
trazer de volta o arquivo para o original.
.Sp
A presunção de \s-1UTF\-16LE\s0 funciona como um \fImodo de conversão\fR. Ao alternara
o modo \fIascii\fR padrão, a presunção de \s-1UTF\-16LE\s0 é desativada.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Presume que o formato de arquivo de entrada é \s-1UTF\-16BE.\s0
.Sp
Essa opção funciona o mesmo que a opção \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Exibe mensagens detalhadas. Informação extra é exibida sobre marcas de ordem
de byte e a quantidade de quebras de linha convertidas.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Segue ligações simbólicas e converte os alvos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Substitui ligações simbólicas com arquivos convertidos (arquivos alvo
originais permanecem inalterados).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Mentém ligações simbólicas e alvos inalterados (padrão).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Exibe informação da versão e sai.
.SH "MODO MAC"
.IX Header "MODO MAC"
No modo normal, as quebras de linhas são convertidas de \s-1DOS\s0 para Unix e
vice-versa. Quebras de linha do Mac não são convertidas.
.PP
No modo Mac, quebras de linha são convertidas de Mac para Unix e
vice-versa. Quebras de linha do \s-1DOS\s0 não são alteradas.
.PP
Para executar no modo Mac, use a opção de linha de comando \f(CW\*(C`\-c mac\*(C'\fR ou use
os comandos \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSÃO"
.IX Header "MODOS DE CONVERSÃO"
.IP "\fBascii\fR" 4
.IX Item "ascii"
No modo \f(CW\*(C`ascii\*(C'\fR, apenas as quebras de linha são convertidas. Esse é o modo
de conversão padrão.
.Sp
Apesar do nome deste modo ser \s-1ASCII,\s0 o qual é um padrão de 7 bit, o modo é
em verdade 8 bit. Sempre use este modo quando quiser converter arquivos
Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Neste modo todos os caracteres não\-ASCII de 8 bit (com valores entre 128 e
255) são convertidos para um espaço de 7 bit.
.IP "\fBiso\fR" 4
.IX Item "iso"
Caracteres são convertidos entre um conjunto de caracteres do \s-1DOS \s0(página de
código) e conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latin\-1) no Unix. Caracteres de
\&\s-1DOS\s0 sem um equivalente \s-1ISO\-8859\-1,\s0 para os quais a conversão não é possível,
são convertidos para um ponto. O mesmo vale para caracteres \s-1ISO\-8859\-1\s0 sem a
contraparte \s-1DOS.\s0
.Sp
Quando apenas a opção \f(CW\*(C`\-iso\*(C'\fR for usada, dos2unix vai tentar determinar a
página de código ativa. Quando isso não for possível, dos2unix vai usar a
página de código padrão \s-1CP437,\s0 a qual é usada principalmente nos \s-1EUA.\s0 Para
forçar uma página de código específica, use as opções \f(CW\*(C`\-437\*(C'\fR (\s-1EUA\s0), \f(CW\*(C`\-850\*(C'\fR
(Europeu oriental), \f(CW\*(C`\-860\*(C'\fR (Português), \f(CW\*(C`\-863\*(C'\fR (Franco-canadense) ou
\&\f(CW\*(C`\-865\*(C'\fR (Nórdico). Também há suporte à página de código do Windows \s-1CP1252
\&\s0(Europeu ocidental) com a opção \f(CW\*(C`\-1252\*(C'\fR. Para outras páginas de código, use
dos2unix em combinação cm \fIiconv\fR\|(1). Iconv pode converter entre uma lista
grande de codificações de caracteres.
.Sp
Nunca use conversão \s-1ISO\s0 em arquivos textos Unicode. Isso vai corromper os
arquivos codificados em \s-1UTF\-8.\s0
.Sp
Alguns exemplos:
.Sp
Conversão da página de código padrão do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP850\s0 do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para \s-1UTF\-8 \s0(Unicode) do Unix:
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrada.txt | dos2unix > saída.txt
.Ve
.Sp
Conversão de Latin\-1 do Unix para página de código padrão do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do Unix para \s-1CP850\s0 do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do \s-1UTF\-8 \s0(Unicode) do Unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t CP1252 > saída.txt
.Ve
.Sp
Veja também <http://czyborra.com/charsets/codepages.html> e
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificações"
.IX Subsection "Codificações"
Exitem codificações Unicode diferentes. No Unix e no Linux, arquivos Unicode
são geralmente codificados em \s-1UTF\-8.\s0 No Windows, arquivos texto Unicode
podem ser codificados em \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 big endian, mas na maioria
das vezes são codificados no formato \s-1UTF\-16.\s0
.SS "Conversão"
.IX Subsection "Conversão"
Arquivos texto em Unicode pode ter quebras de linha \s-1DOS,\s0 Unix ou Mac, como
arquivos texto comuns.
.PP
Todas as versões do dos2unix e unix2dos podem converter arquivos codificados
em \s-1UTF\-8\s0 porque \s-1UTF\-8\s0 foi projetado para ter compatibilidade reversa com
\&\s-1ASCII.\s0
.PP
Dos2unix e unix2dos com suporte a Unicode \s-1UTF\-16\s0 podem ler arquivos texto
codificados em little e big endian \s-1UTF\-16.\s0 Para ver se dos2unix foi
compilado com suporte a \s-1UTF\-16,\s0 digite \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
No Unix/Linux, arquivos codificados em \s-1UTF\-16\s0 são convertidos para a
codificação de caracteres do localização. Use o comando \fIlocale\fR\|(1) para
descobrir qual é a codificação de caracteres da localização. Quando a
conversão não for possível, ocorrerá um erro e o arquivo será ignorado.
.PP
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para
\&\s-1UTF\-8.\s0 Arquivos texto formatados em \s-1UTF\-8\s0 possuem ótimo suporte em ambos
Windows e Unix/Linux.
.PP
Codificações \s-1UTF\-16\s0 e \s-1UTF\-8\s0 são completamente compatíveis, não havendo
qualquer perda de texto na conversão. Quando um erro de conversão \s-1UTF\-16\s0
para \s-1UTF\-8\s0 ocorre, por exemplo quando o arquivo de entrada \s-1UTF\-16 \s0 contém um
erro, o arquivo será ignorado.
.PP
Quando a opção \f(CW\*(C`\-u\*(C'\fR é usada, o arquivo de saída será escrito na mesma
codificação \s-1UTF\-16\s0 que o arquivo de saída. A opção \f(CW\*(C`\-u\*(C'\fR evita conversão
para \s-1UTF\-8.\s0
.PP
Dos2unix e unix2dos não possuem opção para converter arquivos \s-1UTF\-8\s0 ára
\&\s-1UTF\-16.\s0
.PP
Modo de conversão \s-1ISO\s0 e 7\-bit não funciona em arquivos \s-1UTF\-16.\s0
.SS "Marca de ordem de byte"
.IX Subsection "Marca de ordem de byte"
No Windows, arquivos Unicode normalmente têm uma Marca de Ordem de Byte
(\s-1BOM\s0), porque muitos programas (incluindo o Bloco de Notas) adiciona BOMs
por padrão. Veja também <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
No Unix, arquivos Unicode normalmente não têm \s-1BOM.\s0 Presume-se que arquivos
texto são codificados na codificação de caracteres da localização.
.PP
Dos2unix pode detectar apenas se um arquivo está no formato \s-1UTF\-16\s0 se o
arquivo tiver \s-1BOM.\s0 Quando um arquivo \s-1UTF\-16\s0 não tiver \s-1BOM,\s0 dos2unix vai ver
se o arquivo é um arquivo binário.
.PP
Use a opção \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR para converter um arquivo \s-1UTF\-16\s0 sem \s-1BOM.\s0
.PP
Dos2unix escreve por padrão nenhum \s-1BOM\s0 no arquivo de saída. Com a opção
\&\f(CW\*(C`\-b\*(C'\fR, o Dos2unix escreve um \s-1BOM\s0 quando o arquivo de entrada possuir \s-1BOM.\s0
.PP
Unix2dos escreve por padrão um \s-1BOM\s0 no arquivo de saída quando o arquivo de
entrada tem \s-1BOM.\s0 Use a opção \f(CW\*(C`\-m\*(C'\fR para remover \s-1BOM.\s0
.PP
Dos2unix e unix2dos sempre escrevem \s-1BOM\s0 quando a opção \f(CW\*(C`\-m\*(C'\fR é usada.
.SS "Exemplos de Unicode"
.IX Subsection "Exemplos de Unicode"
Conversão de \s-1UTF\-16\s0 do Windows (com \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-16LE\s0 do Windows (sem \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 Unix para \s-1UTF\-8\s0 do Windows com \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 do Unix para \s-1UTF\-16\s0 do Windows:
.PP
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t UTF\-16 > saída.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 é um padrão governamental chinês. Um subconjunto obrigatório do
padrão \s-1GB18030\s0 é exigido oficialmente para todos os produtos de software
vendidos na China. Veja também <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 é completamente compatível com Unicode e pode ser considerado um
formato de transformação de unicode. Assim como \s-1UTF\-8, GB18030\s0 é compatível
com \s-1ASCII. GB18030\s0 também é compatível com a página de código 936 do
Windows, também conhecida como \s-1GBK.\s0
.PP
No Unix/Linux, arquivos \s-1UTF\-16\s0 são convertidos para \s-1GB18030\s0 quando a
codificação da localização é definida para \s-1GB18030.\s0 Note que isso vai
funcionar apenas se a localização estiver definida para China. Por exemplo,
em uma configuração de localização inglesa (Britânia) a conversão
\&\f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0 para \s-1GB18030\s0 não vai funcionar, mas em uma
configuração de localização \f(CW\*(C`zh_CN.GB18030\*(C'\fR chinesa vai funcionar.
.PP
No Windows, você precisa usar a opção \f(CW\*(C`\-gb\*(C'\fR para converter arquivos \s-1UTF\-16\s0
para \s-1GB18030.\s0
.PP
Arquivos codificados em \s-1GB18030\s0 possuem uma marca de ordem de bytes, como
arquivos Unicode.
.SH "EXEMPLOS"
.IX Header "EXEMPLOS"
Lê a entrada da \*(L"stdin\*(R" e escreve a saída para \*(L"stdout\*(R":
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Converte e substitui a.txt. Converte e substitui b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii. Converte e substitui
b.txt no modo de conversão 7bit:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Converte a.txt do formato do Mac para Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Converte a.txt do formato do Unix para Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Converte e substitui a.txt enquanto mantém a marca de data original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Converte a.txt e escreve para e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Converte a.txt e escreve para e.txt, mantém a marca de data de e.txt igual a
a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Converte e substitui a.txt. Converte b.txt e escreve para e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Converte c.txt e escreve para e.txt. Converte e substitui a.txt. Converte e
substitui b.txt. Converte d.txt e escreve para f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "Conversão recursiva"
.IX Header "Conversão recursiva"
Use dos2unix em combinação com os comandos \fIfind\fR\|(1) e \fIxargs\fR\|(1) para converter
recursivamente arquivos texto em uma estrutura de árvore de diretórios. Por
exemplo, para converter todos os arquivos .txt na árvore de diretórios sob o
diretório atual, digite:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZAÇÃO"
.IX Header "LOCALIZAÇÃO"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
O idioma primário é selecionado com a variável de ambiente \s-1LANG. A\s0 variável
\&\s-1LANG\s0 consiste em várias partes. A primeira parte está em letras pequenas no
código do idioma. A segunda parte é opcional e é o código do país em letras
maiúsculo, precedido de um ponto. Alguns exemplos para shells do tipo padrão
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl Holandês
\& export LANG=nl_NL Holandês, Holanda
\& export LANG=nl_BE Holandês, Bélgica
\& export LANG=es_ES Espanhol, Espanha
\& export LANG=es_MX Espanhol, México
\& export LANG=en_US.iso88591 Inglês, EUA, codificação Latin\-1
\& export LANG=en_GB.UTF\-8 Inglês, Reino Unido, codificação UTF\-8
.Ve
.Sp
Para a lista completa de códigos de idioma e país, veja o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Nos sistemas Unix, você pode usar o comando \fIlocale\fR\|(1) para obter informação
específica da localização.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Com a variável de ambiente \s-1LANGUAGE,\s0 você pode especificar uma lista de
prioridades de idiomas, separada por vírgulas. Dos2unix fornece preferência
à \s-1LANGUAGE\s0 sobre \s-1LANG.\s0 Por exemplo, primeiro holandês e, então, alemão:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Você primeiro tem que habilitar localização, definindo
\&\s-1LANG \s0(ou \s-1LC_ALL\s0) para um valor diferente de \*(L"C\*(R", antes que você possa usar
uma lista de prioridade de idioma por meio da variável \s-1LANGUAGE.\s0 Veja também
o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Se você selecionou um idioma que não está disponível, você vai terá as
mensagens em inglês (padrão).
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Com a variável de ambiente \s-1DOS2UNIX_LOCALEDIR,\s0 o \s-1LOCALEDIR\s0 definido durante
a compilação pode ser sobrescrito. \s-1LOCALEDIR\s0 é usada para localizar os
arquivos de idioma. O valor padrão do \s-1GNU\s0 é \f(CW\*(C`/usr/local/share/locale\*(C'\fR. A
opção \fB\-\-version\fR vai exibir o \s-1LOCALEDIR\s0 que é usado.
.Sp
Exemplo (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR RETORNADO"
.IX Header "VALOR RETORNADO"
No sucesso, zero é retornado. Quando um erro de sistema ocorre, o último
erro de sistema será retornado. Para outros erros, 1 é retornado.
.PP
O valor retornado é sempre zero no modo quieto, exceto quando opções de
linha de comando erradas são usadas.
.SH "PADRÕES"
.IX Header "PADRÕES"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au> Bernd Johannes Wuebben (modo mac2unix)
\&\- <wuebben@kde.org>, Christian Wurll (adiciona nova linha extra) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (mantenedor)
.PP
Página do projeto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página do SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "Veja também"
.IX Header "Veja também"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,754 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOME"
.IX Header "NOME"
dos2unix \- Conversor de formato de arquivo texto de DOS/Mac para Unix e
vice-versa
.SH "SINOPSE"
.IX Header "SINOPSE"
.Vb 2
\& dos2unix [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
\& unix2dos [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
.Ve
.SH "DESCRIÇÃO"
.IX Header "DESCRIÇÃO"
O pacote Dos2unix inclui utilitários de \f(CW\*(C`dos2unix\*(C'\fR e \f(CW\*(C`unix2dos\*(C'\fR para
converter arquivos texto nos formatos \s-1DOS\s0 ou Mac para formato Unix e
vice-versa.
.PP
Em arquivos texto DOS/Windows uma quebra de linha, também conhecida como
nova linha, é uma combinação de dois caracteres: um Carriage Return (\s-1CR\s0)
seguido por um Line Feed (\s-1LF\s0). Em arquivos texto do Unix uma quebra de linha
é um único caractere: o Line Feed (\s-1LF\s0). Em arquivos texto do Mac, anteriores
ao Mac \s-1OS X,\s0 uma quebra de linha era um único caractere Carriage Return
(\s-1CR\s0). Hoje em dia, Mac \s-1OS\s0 usa quebras de linha no estilo do Unix (\s-1LF\s0).
.PP
Além das quebras de linhas, Dos2unix também pode converter as codificações
de arquivos. Algumas poucas páginas podem ser convertidos para Latin\-1 para
Unix. E arquivos Unicode do Windows (\s-1UTF\-16\s0) podem ser convertidos para
arquivos Unicode do Unix (\s-1UTF\-8\s0).
.PP
Arquivos binários são ignorados automaticamente, a menos que a conversão
seja forçada.
.PP
Arquivos não regulares, tais como diretórios e FIFOs, são ignorados
automaticamente.
.PP
Ligações simbólicas e seus alvos são por padrão mantidas
intocáveis. Ligações simbólicas podem opcionalmente ser substituídas, ou a
saída pode ser escrita para o alvo das ligações simbólicas. Não há suporte
às ligações simbólicas do Windows.
.PP
Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. Há uma diferença
importante em relação à versão original do SunOS/Solaris. Essa versão faz
conversão no-lugar (modo arquivo antigo) por padrão, enquanto a versão
original do SunOS/Solaris fornecia suporte apenas a conversão pareada (modo
de novo arquivo). Veja também as opções \f(CW\*(C`\-o\*(C'\fR e \f(CW\*(C`\-n\*(C'\fR.
.SH "OPÇÕES"
.IX Header "OPÇÕES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Trata as opções seguintes como nomes de arquivos. Use essa opção se você
quiser converter arquivos cujos nomes iniciam com um traço. Por exemplo,
para converter um arquivo chamado \*(L"foo\*(R", você pode usar este comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou em modo de novo arquivo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo saída.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Converte apenas as quebras de linhas. Esse é o modo de conversão padrão.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversão entre conjunto de caractere do \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Veja também a
seção \s-1MODOS DE\s0 CONVERSÃO.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa a página de código 1252 do Windows (Europa ocidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa a página de código 437 do \s-1DOS \s0(\s-1EUA\s0). Essa é a página de código padrão
usada para conversão \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa a página de código 850 do \s-1DOS \s0(Europa ocidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa a página de código 860 do \s-1DOS \s0(Português).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa a página de código 863 do \s-1DOS \s0(Francês do Canadá).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa a página de código 865 do \s-1DOS \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Converte caracteres de 8 bit para espaço de 7 bit.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantém marca de ordem de bytes (\s-1BOM\s0). Quando o arquivo de entrada possuir um
\&\s-1BOM,\s0 escreve um \s-1BOM\s0 no arquivo de saída. Esse é o comportamento padrão ao
converter para quebras de linha do \s-1DOS.\s0 Veja também a opção \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODOCONV\s0\fR" 4
.IX Item "-c, --convmode MODOCONV"
Define o modo de conversão, sendo \s-1MODOCONV\s0 um dentre: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, \fImac\fR com ascii sendo o padrão.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Força a conversão de arquivos binários.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para \s-1UTF\-8,\s0
independentemente da localização definida. Use esta opção para converter
arquivos \s-1UTF\-16\s0 para \s-1GB18030.\s0 Essa opção está disponível apenas no
Windows. Veja também a seção \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Exibe ajuda e sai.
.IP "\fB\-i[OPÇÕES], \-\-info[=OPÇÕES] \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-i[OPÇÕES], --info[=OPÇÕES] ARQUIVO ..."
Exibe informação do arquivo. Nenhuma conversão é feita.
.Sp
A seguinte informação é exibida, nesta ordem: número de quebras de linha do
\&\s-1DOS,\s0 número de quebras de linha do Unix, número de quebras de linha do Mac,
marca de ordem de byte, \*(L"text\*(R" ou \*(L"binário\*(R", nome de arquivo.
.Sp
Saída de exemplo:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcionalmente, opções extra podem ser definidas para alterar a saída. Uma ou
mais opções podem ser adicionadas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Exibe o número de quebras de linhas do \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Exibe o número de quebras de linhas do Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Exibe o número de quebras de linhas do Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Exibe a marca de ordem de byte.
.IP "\fBt\fR" 4
.IX Item "t"
Exibe se arquivo é texto ou binário.
.IP "\fBc\fR" 4
.IX Item "c"
Exib apenas os arquivos que seriam convertidos.
.Sp
Com a opção \f(CW\*(C`c\*(C'\fR, dos2unix vai exibir apenas os arquivos que contêm quebras
de linha do \s-1DOS,\s0 unix2dos vai exibir apenas os nomes de arquivos que contêm
quebras de linha do Unix.
.RE
.RS 4
.Sp
Exemplos:
.Sp
Mostra informação sobre todos os arquivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Mostra apenas o número de quebras de linha \s-1DOS\s0 e Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Mostra apenas a marca de ordem de byte:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantém a marca da data do arquivo de saída igual ao do arquivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Exibe a licença do programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Adiciona nova linha adicional.
.Sp
\&\fBdos2unix\fR: Apenas quebras de linha do \s-1DOS\s0 são alteradas para duas quebras
de linha do Unix. No modo Mac, apenas quebras de linha do Mac são alterados
para duas quebras de linha do Unix.
.Sp
\&\fBunix2dos\fR: Apenas quebras de linha do Unix são alteradas para duas quebras
de linha do \s-1DOS.\s0 No modo Mac, quebras de linha do Unix são alteradas para
duas quebras de linha do Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escreve uma marca de ordem de byte (\s-1BOM\s0) no arquivo de saída. Por padrão, um
\&\s-1BOM UTF\-8\s0 é escrito.
.Sp
Quando o arquivo de entrada é \s-1UTF\-16,\s0 e a opção \f(CW\*(C`\-u\*(C'\fR é usada, um \s-1BOM UTF\-16\s0
será escrito.
.Sp
Nunca use essa opção quando a codificação de saída é outra além de \s-1UTF\-8\s0 ou
\&\s-1UTF\-16.\s0 Veja também a seção \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARQENT\s0 ARQSAÍDA ...\fR" 4
.IX Item "-n, --newfile ARQENT ARQSAÍDA ..."
Modo de novo arquivo. Converte o arquivo \s-1ARQENT\s0 e escreve a saída para o
arquivo ARQSAÍDA. Os nomes de arquivos devem ser fornecidos em pares e nome
coringa \fInão\fR deveriam ser usados ou você \fIvai\fR perder seus arquivos.
.Sp
A pessoa que começa a conversão em modo novo arquivo (pareado) será o dono
do arquivo convertido. As permissões de leitura/escrita do novo arquivo
serão as permissões do arquivo original menos a \fIumask\fR\|(1) da pessoa que
executa a conversão.
.IP "\fB\-o, \-\-oldfile \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARQUIVO ..."
Modo arquivo antigo. Converte o arquivo \s-1ARQUIVO\s0 e o sobrescreve com a
saída. O programa, por padrão, executa neste modo. Nomes coringas podem ser
usados.
.Sp
No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no mesmo
dono, grupo e permissões de leitura/escrita que o arquivo original. Também,
quando o arquivo é convertido por outro usuário que tenha permissões de
escrita no arquivo (ex.: usuário root). A conversão será abortada quando não
for possível preservar os valores originais. Alteração do dono pode
significar que o dono original não é mais capaz de ler o arquivo. Alteração
do grupo pode ser um risco para a segurança, pois o arquivo pode ficar
legível para pessoas cujo acesso não é desejado. Preservação do dono, grupo
e permissões de leitura/escrita tem suporte apenas no Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo quieto. Suprime todos os avios e mensagens. O valor retornado é
zero. Exceto quando opções de linha de comando erradas forem usadas.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
remove marca de ordem de bytes (\s-1BOM\s0). Não escreve um \s-1BOM\s0 no arquivo de
saída. Esse é o comportamento padrão ao converter para quebras de linha
Unix. Veja também a opção \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora arquivo binários (padrão).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantém a codificação \s-1UTF\-16\s0 original do arquivo de entrada. O arquivo de
saída será escrito na mesma codificação \s-1UTF\-16,\s0 em little ou big endian,
como o arquivo de entrada. Isso evita transformação para \s-1UTF\-8.\s0 Como
consequência, um \s-1BOM UTF\-16\s0 será escrito. Essa opção pode ser desabilitada
com a opção \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Presume que o formato de arquivo de entrada é \s-1UTF\-16LE.\s0
.Sp
Quando há uma marca de ordem de byte no arquivo de entrada, esta tem
prioridade sobre essa opção.
.Sp
Quando você fizer uma presunção equivocada (o arquivo de entrada não estava
no formato \s-1UTF\-16LE\s0) e a conversão funcionar, você terá um arquivo de saída
\&\s-1UTF\-8\s0 com texto errado. Você pode desfazer a conversão errada com \fIiconv\fR\|(1)
pela conversão do arquivo de saída \s-1UTF\-8\s0 de volta para \s-1UTF\-16LE.\s0 Isso vai
trazer de volta o arquivo para o original.
.Sp
A presunção de \s-1UTF\-16LE\s0 funciona como um \fImodo de conversão\fR. Ao alternara
o modo \fIascii\fR padrão, a presunção de \s-1UTF\-16LE\s0 é desativada.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Presume que o formato de arquivo de entrada é \s-1UTF\-16BE.\s0
.Sp
Essa opção funciona o mesmo que a opção \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Exibe mensagens detalhadas. Informação extra é exibida sobre marcas de ordem
de byte e a quantidade de quebras de linha convertidas.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Segue ligações simbólicas e converte os alvos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Substitui ligações simbólicas com arquivos convertidos (arquivos alvo
originais permanecem inalterados).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Mentém ligações simbólicas e alvos inalterados (padrão).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Exibe informação da versão e sai.
.SH "MODO MAC"
.IX Header "MODO MAC"
No modo normal, as quebras de linhas são convertidas de \s-1DOS\s0 para Unix e
vice-versa. Quebras de linha do Mac não são convertidas.
.PP
No modo Mac, quebras de linha são convertidas de Mac para Unix e
vice-versa. Quebras de linha do \s-1DOS\s0 não são alteradas.
.PP
Para executar no modo Mac, use a opção de linha de comando \f(CW\*(C`\-c mac\*(C'\fR ou use
os comandos \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSÃO"
.IX Header "MODOS DE CONVERSÃO"
.IP "\fBascii\fR" 4
.IX Item "ascii"
No modo \f(CW\*(C`ascii\*(C'\fR, apenas as quebras de linha são convertidas. Esse é o modo
de conversão padrão.
.Sp
Apesar do nome deste modo ser \s-1ASCII,\s0 o qual é um padrão de 7 bit, o modo é
em verdade 8 bit. Sempre use este modo quando quiser converter arquivos
Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Neste modo todos os caracteres não\-ASCII de 8 bit (com valores entre 128 e
255) são convertidos para um espaço de 7 bit.
.IP "\fBiso\fR" 4
.IX Item "iso"
Caracteres são convertidos entre um conjunto de caracteres do \s-1DOS \s0(página de
código) e conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latin\-1) no Unix. Caracteres de
\&\s-1DOS\s0 sem um equivalente \s-1ISO\-8859\-1,\s0 para os quais a conversão não é possível,
são convertidos para um ponto. O mesmo vale para caracteres \s-1ISO\-8859\-1\s0 sem a
contraparte \s-1DOS.\s0
.Sp
Quando apenas a opção \f(CW\*(C`\-iso\*(C'\fR for usada, dos2unix vai tentar determinar a
página de código ativa. Quando isso não for possível, dos2unix vai usar a
página de código padrão \s-1CP437,\s0 a qual é usada principalmente nos \s-1EUA.\s0 Para
forçar uma página de código específica, use as opções \f(CW\*(C`\-437\*(C'\fR (\s-1EUA\s0), \f(CW\*(C`\-850\*(C'\fR
(Europeu oriental), \f(CW\*(C`\-860\*(C'\fR (Português), \f(CW\*(C`\-863\*(C'\fR (Franco-canadense) ou
\&\f(CW\*(C`\-865\*(C'\fR (Nórdico). Também há suporte à página de código do Windows \s-1CP1252
\&\s0(Europeu ocidental) com a opção \f(CW\*(C`\-1252\*(C'\fR. Para outras páginas de código, use
dos2unix em combinação cm \fIiconv\fR\|(1). Iconv pode converter entre uma lista
grande de codificações de caracteres.
.Sp
Nunca use conversão \s-1ISO\s0 em arquivos textos Unicode. Isso vai corromper os
arquivos codificados em \s-1UTF\-8.\s0
.Sp
Alguns exemplos:
.Sp
Conversão da página de código padrão do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP850\s0 do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para \s-1UTF\-8 \s0(Unicode) do Unix:
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrada.txt | dos2unix > saída.txt
.Ve
.Sp
Conversão de Latin\-1 do Unix para página de código padrão do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do Unix para \s-1CP850\s0 do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do \s-1UTF\-8 \s0(Unicode) do Unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t CP1252 > saída.txt
.Ve
.Sp
Veja também <http://czyborra.com/charsets/codepages.html> e
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificações"
.IX Subsection "Codificações"
Exitem codificações Unicode diferentes. No Unix e no Linux, arquivos Unicode
são geralmente codificados em \s-1UTF\-8.\s0 No Windows, arquivos texto Unicode
podem ser codificados em \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 big endian, mas na maioria
das vezes são codificados no formato \s-1UTF\-16.\s0
.SS "Conversão"
.IX Subsection "Conversão"
Arquivos texto em Unicode pode ter quebras de linha \s-1DOS,\s0 Unix ou Mac, como
arquivos texto comuns.
.PP
Todas as versões do dos2unix e unix2dos podem converter arquivos codificados
em \s-1UTF\-8\s0 porque \s-1UTF\-8\s0 foi projetado para ter compatibilidade reversa com
\&\s-1ASCII.\s0
.PP
Dos2unix e unix2dos com suporte a Unicode \s-1UTF\-16\s0 podem ler arquivos texto
codificados em little e big endian \s-1UTF\-16.\s0 Para ver se dos2unix foi
compilado com suporte a \s-1UTF\-16,\s0 digite \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
No Unix/Linux, arquivos codificados em \s-1UTF\-16\s0 são convertidos para a
codificação de caracteres do localização. Use o comando \fIlocale\fR\|(1) para
descobrir qual é a codificação de caracteres da localização. Quando a
conversão não for possível, ocorrerá um erro e o arquivo será ignorado.
.PP
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para
\&\s-1UTF\-8.\s0 Arquivos texto formatados em \s-1UTF\-8\s0 possuem ótimo suporte em ambos
Windows e Unix/Linux.
.PP
Codificações \s-1UTF\-16\s0 e \s-1UTF\-8\s0 são completamente compatíveis, não havendo
qualquer perda de texto na conversão. Quando um erro de conversão \s-1UTF\-16\s0
para \s-1UTF\-8\s0 ocorre, por exemplo quando o arquivo de entrada \s-1UTF\-16 \s0 contém um
erro, o arquivo será ignorado.
.PP
Quando a opção \f(CW\*(C`\-u\*(C'\fR é usada, o arquivo de saída será escrito na mesma
codificação \s-1UTF\-16\s0 que o arquivo de saída. A opção \f(CW\*(C`\-u\*(C'\fR evita conversão
para \s-1UTF\-8.\s0
.PP
Dos2unix e unix2dos não possuem opção para converter arquivos \s-1UTF\-8\s0 ára
\&\s-1UTF\-16.\s0
.PP
Modo de conversão \s-1ISO\s0 e 7\-bit não funciona em arquivos \s-1UTF\-16.\s0
.SS "Marca de ordem de byte"
.IX Subsection "Marca de ordem de byte"
No Windows, arquivos Unicode normalmente têm uma Marca de Ordem de Byte
(\s-1BOM\s0), porque muitos programas (incluindo o Bloco de Notas) adiciona BOMs
por padrão. Veja também <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
No Unix, arquivos Unicode normalmente não têm \s-1BOM.\s0 Presume-se que arquivos
texto são codificados na codificação de caracteres da localização.
.PP
Dos2unix pode detectar apenas se um arquivo está no formato \s-1UTF\-16\s0 se o
arquivo tiver \s-1BOM.\s0 Quando um arquivo \s-1UTF\-16\s0 não tiver \s-1BOM,\s0 dos2unix vai ver
se o arquivo é um arquivo binário.
.PP
Use a opção \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR para converter um arquivo \s-1UTF\-16\s0 sem \s-1BOM.\s0
.PP
Dos2unix escreve por padrão nenhum \s-1BOM\s0 no arquivo de saída. Com a opção
\&\f(CW\*(C`\-b\*(C'\fR, o Dos2unix escreve um \s-1BOM\s0 quando o arquivo de entrada possuir \s-1BOM.\s0
.PP
Unix2dos escreve por padrão um \s-1BOM\s0 no arquivo de saída quando o arquivo de
entrada tem \s-1BOM.\s0 Use a opção \f(CW\*(C`\-m\*(C'\fR para remover \s-1BOM.\s0
.PP
Dos2unix e unix2dos sempre escrevem \s-1BOM\s0 quando a opção \f(CW\*(C`\-m\*(C'\fR é usada.
.SS "Exemplos de Unicode"
.IX Subsection "Exemplos de Unicode"
Conversão de \s-1UTF\-16\s0 do Windows (com \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-16LE\s0 do Windows (sem \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 Unix para \s-1UTF\-8\s0 do Windows com \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 do Unix para \s-1UTF\-16\s0 do Windows:
.PP
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t UTF\-16 > saída.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 é um padrão governamental chinês. Um subconjunto obrigatório do
padrão \s-1GB18030\s0 é exigido oficialmente para todos os produtos de software
vendidos na China. Veja também <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 é completamente compatível com Unicode e pode ser considerado um
formato de transformação de unicode. Assim como \s-1UTF\-8, GB18030\s0 é compatível
com \s-1ASCII. GB18030\s0 também é compatível com a página de código 936 do
Windows, também conhecida como \s-1GBK.\s0
.PP
No Unix/Linux, arquivos \s-1UTF\-16\s0 são convertidos para \s-1GB18030\s0 quando a
codificação da localização é definida para \s-1GB18030.\s0 Note que isso vai
funcionar apenas se a localização estiver definida para China. Por exemplo,
em uma configuração de localização inglesa (Britânia) a conversão
\&\f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0 para \s-1GB18030\s0 não vai funcionar, mas em uma
configuração de localização \f(CW\*(C`zh_CN.GB18030\*(C'\fR chinesa vai funcionar.
.PP
No Windows, você precisa usar a opção \f(CW\*(C`\-gb\*(C'\fR para converter arquivos \s-1UTF\-16\s0
para \s-1GB18030.\s0
.PP
Arquivos codificados em \s-1GB18030\s0 possuem uma marca de ordem de bytes, como
arquivos Unicode.
.SH "EXEMPLOS"
.IX Header "EXEMPLOS"
Lê a entrada da \*(L"stdin\*(R" e escreve a saída para \*(L"stdout\*(R":
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Converte e substitui a.txt. Converte e substitui b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii. Converte e substitui
b.txt no modo de conversão 7bit:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Converte a.txt do formato do Mac para Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Converte a.txt do formato do Unix para Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Converte e substitui a.txt enquanto mantém a marca de data original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Converte a.txt e escreve para e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Converte a.txt e escreve para e.txt, mantém a marca de data de e.txt igual a
a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Converte e substitui a.txt. Converte b.txt e escreve para e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Converte c.txt e escreve para e.txt. Converte e substitui a.txt. Converte e
substitui b.txt. Converte d.txt e escreve para f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "Conversão recursiva"
.IX Header "Conversão recursiva"
Use dos2unix em combinação com os comandos \fIfind\fR\|(1) e \fIxargs\fR\|(1) para converter
recursivamente arquivos texto em uma estrutura de árvore de diretórios. Por
exemplo, para converter todos os arquivos .txt na árvore de diretórios sob o
diretório atual, digite:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZAÇÃO"
.IX Header "LOCALIZAÇÃO"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
O idioma primário é selecionado com a variável de ambiente \s-1LANG. A\s0 variável
\&\s-1LANG\s0 consiste em várias partes. A primeira parte está em letras pequenas no
código do idioma. A segunda parte é opcional e é o código do país em letras
maiúsculo, precedido de um ponto. Alguns exemplos para shells do tipo padrão
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl Holandês
\& export LANG=nl_NL Holandês, Holanda
\& export LANG=nl_BE Holandês, Bélgica
\& export LANG=es_ES Espanhol, Espanha
\& export LANG=es_MX Espanhol, México
\& export LANG=en_US.iso88591 Inglês, EUA, codificação Latin\-1
\& export LANG=en_GB.UTF\-8 Inglês, Reino Unido, codificação UTF\-8
.Ve
.Sp
Para a lista completa de códigos de idioma e país, veja o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Nos sistemas Unix, você pode usar o comando \fIlocale\fR\|(1) para obter informação
específica da localização.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Com a variável de ambiente \s-1LANGUAGE,\s0 você pode especificar uma lista de
prioridades de idiomas, separada por vírgulas. Dos2unix fornece preferência
à \s-1LANGUAGE\s0 sobre \s-1LANG.\s0 Por exemplo, primeiro holandês e, então, alemão:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Você primeiro tem que habilitar localização, definindo
\&\s-1LANG \s0(ou \s-1LC_ALL\s0) para um valor diferente de \*(L"C\*(R", antes que você possa usar
uma lista de prioridade de idioma por meio da variável \s-1LANGUAGE.\s0 Veja também
o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Se você selecionou um idioma que não está disponível, você vai terá as
mensagens em inglês (padrão).
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Com a variável de ambiente \s-1DOS2UNIX_LOCALEDIR,\s0 o \s-1LOCALEDIR\s0 definido durante
a compilação pode ser sobrescrito. \s-1LOCALEDIR\s0 é usada para localizar os
arquivos de idioma. O valor padrão do \s-1GNU\s0 é \f(CW\*(C`/usr/local/share/locale\*(C'\fR. A
opção \fB\-\-version\fR vai exibir o \s-1LOCALEDIR\s0 que é usado.
.Sp
Exemplo (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR RETORNADO"
.IX Header "VALOR RETORNADO"
No sucesso, zero é retornado. Quando um erro de sistema ocorre, o último
erro de sistema será retornado. Para outros erros, 1 é retornado.
.PP
O valor retornado é sempre zero no modo quieto, exceto quando opções de
linha de comando erradas são usadas.
.SH "PADRÕES"
.IX Header "PADRÕES"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au> Bernd Johannes Wuebben (modo mac2unix)
\&\- <wuebben@kde.org>, Christian Wurll (adiciona nova linha extra) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (mantenedor)
.PP
Página do projeto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página do SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "Veja também"
.IX Header "Veja também"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,754 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOME"
.IX Header "NOME"
dos2unix \- Conversor de formato de arquivo texto de DOS/Mac para Unix e
vice-versa
.SH "SINOPSE"
.IX Header "SINOPSE"
.Vb 2
\& dos2unix [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
\& unix2dos [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
.Ve
.SH "DESCRIÇÃO"
.IX Header "DESCRIÇÃO"
O pacote Dos2unix inclui utilitários de \f(CW\*(C`dos2unix\*(C'\fR e \f(CW\*(C`unix2dos\*(C'\fR para
converter arquivos texto nos formatos \s-1DOS\s0 ou Mac para formato Unix e
vice-versa.
.PP
Em arquivos texto DOS/Windows uma quebra de linha, também conhecida como
nova linha, é uma combinação de dois caracteres: um Carriage Return (\s-1CR\s0)
seguido por um Line Feed (\s-1LF\s0). Em arquivos texto do Unix uma quebra de linha
é um único caractere: o Line Feed (\s-1LF\s0). Em arquivos texto do Mac, anteriores
ao Mac \s-1OS X,\s0 uma quebra de linha era um único caractere Carriage Return
(\s-1CR\s0). Hoje em dia, Mac \s-1OS\s0 usa quebras de linha no estilo do Unix (\s-1LF\s0).
.PP
Além das quebras de linhas, Dos2unix também pode converter as codificações
de arquivos. Algumas poucas páginas podem ser convertidos para Latin\-1 para
Unix. E arquivos Unicode do Windows (\s-1UTF\-16\s0) podem ser convertidos para
arquivos Unicode do Unix (\s-1UTF\-8\s0).
.PP
Arquivos binários são ignorados automaticamente, a menos que a conversão
seja forçada.
.PP
Arquivos não regulares, tais como diretórios e FIFOs, são ignorados
automaticamente.
.PP
Ligações simbólicas e seus alvos são por padrão mantidas
intocáveis. Ligações simbólicas podem opcionalmente ser substituídas, ou a
saída pode ser escrita para o alvo das ligações simbólicas. Não há suporte
às ligações simbólicas do Windows.
.PP
Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. Há uma diferença
importante em relação à versão original do SunOS/Solaris. Essa versão faz
conversão no-lugar (modo arquivo antigo) por padrão, enquanto a versão
original do SunOS/Solaris fornecia suporte apenas a conversão pareada (modo
de novo arquivo). Veja também as opções \f(CW\*(C`\-o\*(C'\fR e \f(CW\*(C`\-n\*(C'\fR.
.SH "OPÇÕES"
.IX Header "OPÇÕES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Trata as opções seguintes como nomes de arquivos. Use essa opção se você
quiser converter arquivos cujos nomes iniciam com um traço. Por exemplo,
para converter um arquivo chamado \*(L"foo\*(R", você pode usar este comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou em modo de novo arquivo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo saída.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Converte apenas as quebras de linhas. Esse é o modo de conversão padrão.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversão entre conjunto de caractere do \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Veja também a
seção \s-1MODOS DE\s0 CONVERSÃO.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa a página de código 1252 do Windows (Europa ocidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa a página de código 437 do \s-1DOS \s0(\s-1EUA\s0). Essa é a página de código padrão
usada para conversão \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa a página de código 850 do \s-1DOS \s0(Europa ocidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa a página de código 860 do \s-1DOS \s0(Português).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa a página de código 863 do \s-1DOS \s0(Francês do Canadá).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa a página de código 865 do \s-1DOS \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Converte caracteres de 8 bit para espaço de 7 bit.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantém marca de ordem de bytes (\s-1BOM\s0). Quando o arquivo de entrada possuir um
\&\s-1BOM,\s0 escreve um \s-1BOM\s0 no arquivo de saída. Esse é o comportamento padrão ao
converter para quebras de linha do \s-1DOS.\s0 Veja também a opção \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODOCONV\s0\fR" 4
.IX Item "-c, --convmode MODOCONV"
Define o modo de conversão, sendo \s-1MODOCONV\s0 um dentre: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, \fImac\fR com ascii sendo o padrão.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Força a conversão de arquivos binários.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para \s-1UTF\-8,\s0
independentemente da localização definida. Use esta opção para converter
arquivos \s-1UTF\-16\s0 para \s-1GB18030.\s0 Essa opção está disponível apenas no
Windows. Veja também a seção \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Exibe ajuda e sai.
.IP "\fB\-i[OPÇÕES], \-\-info[=OPÇÕES] \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-i[OPÇÕES], --info[=OPÇÕES] ARQUIVO ..."
Exibe informação do arquivo. Nenhuma conversão é feita.
.Sp
A seguinte informação é exibida, nesta ordem: número de quebras de linha do
\&\s-1DOS,\s0 número de quebras de linha do Unix, número de quebras de linha do Mac,
marca de ordem de byte, \*(L"text\*(R" ou \*(L"binário\*(R", nome de arquivo.
.Sp
Saída de exemplo:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcionalmente, opções extra podem ser definidas para alterar a saída. Uma ou
mais opções podem ser adicionadas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Exibe o número de quebras de linhas do \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Exibe o número de quebras de linhas do Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Exibe o número de quebras de linhas do Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Exibe a marca de ordem de byte.
.IP "\fBt\fR" 4
.IX Item "t"
Exibe se arquivo é texto ou binário.
.IP "\fBc\fR" 4
.IX Item "c"
Exib apenas os arquivos que seriam convertidos.
.Sp
Com a opção \f(CW\*(C`c\*(C'\fR, dos2unix vai exibir apenas os arquivos que contêm quebras
de linha do \s-1DOS,\s0 unix2dos vai exibir apenas os nomes de arquivos que contêm
quebras de linha do Unix.
.RE
.RS 4
.Sp
Exemplos:
.Sp
Mostra informação sobre todos os arquivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Mostra apenas o número de quebras de linha \s-1DOS\s0 e Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Mostra apenas a marca de ordem de byte:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantém a marca da data do arquivo de saída igual ao do arquivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Exibe a licença do programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Adiciona nova linha adicional.
.Sp
\&\fBdos2unix\fR: Apenas quebras de linha do \s-1DOS\s0 são alteradas para duas quebras
de linha do Unix. No modo Mac, apenas quebras de linha do Mac são alterados
para duas quebras de linha do Unix.
.Sp
\&\fBunix2dos\fR: Apenas quebras de linha do Unix são alteradas para duas quebras
de linha do \s-1DOS.\s0 No modo Mac, quebras de linha do Unix são alteradas para
duas quebras de linha do Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escreve uma marca de ordem de byte (\s-1BOM\s0) no arquivo de saída. Por padrão, um
\&\s-1BOM UTF\-8\s0 é escrito.
.Sp
Quando o arquivo de entrada é \s-1UTF\-16,\s0 e a opção \f(CW\*(C`\-u\*(C'\fR é usada, um \s-1BOM UTF\-16\s0
será escrito.
.Sp
Nunca use essa opção quando a codificação de saída é outra além de \s-1UTF\-8\s0 ou
\&\s-1UTF\-16.\s0 Veja também a seção \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARQENT\s0 ARQSAÍDA ...\fR" 4
.IX Item "-n, --newfile ARQENT ARQSAÍDA ..."
Modo de novo arquivo. Converte o arquivo \s-1ARQENT\s0 e escreve a saída para o
arquivo ARQSAÍDA. Os nomes de arquivos devem ser fornecidos em pares e nome
coringa \fInão\fR deveriam ser usados ou você \fIvai\fR perder seus arquivos.
.Sp
A pessoa que começa a conversão em modo novo arquivo (pareado) será o dono
do arquivo convertido. As permissões de leitura/escrita do novo arquivo
serão as permissões do arquivo original menos a \fIumask\fR\|(1) da pessoa que
executa a conversão.
.IP "\fB\-o, \-\-oldfile \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARQUIVO ..."
Modo arquivo antigo. Converte o arquivo \s-1ARQUIVO\s0 e o sobrescreve com a
saída. O programa, por padrão, executa neste modo. Nomes coringas podem ser
usados.
.Sp
No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no mesmo
dono, grupo e permissões de leitura/escrita que o arquivo original. Também,
quando o arquivo é convertido por outro usuário que tenha permissões de
escrita no arquivo (ex.: usuário root). A conversão será abortada quando não
for possível preservar os valores originais. Alteração do dono pode
significar que o dono original não é mais capaz de ler o arquivo. Alteração
do grupo pode ser um risco para a segurança, pois o arquivo pode ficar
legível para pessoas cujo acesso não é desejado. Preservação do dono, grupo
e permissões de leitura/escrita tem suporte apenas no Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo quieto. Suprime todos os avios e mensagens. O valor retornado é
zero. Exceto quando opções de linha de comando erradas forem usadas.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
remove marca de ordem de bytes (\s-1BOM\s0). Não escreve um \s-1BOM\s0 no arquivo de
saída. Esse é o comportamento padrão ao converter para quebras de linha
Unix. Veja também a opção \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora arquivo binários (padrão).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantém a codificação \s-1UTF\-16\s0 original do arquivo de entrada. O arquivo de
saída será escrito na mesma codificação \s-1UTF\-16,\s0 em little ou big endian,
como o arquivo de entrada. Isso evita transformação para \s-1UTF\-8.\s0 Como
consequência, um \s-1BOM UTF\-16\s0 será escrito. Essa opção pode ser desabilitada
com a opção \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Presume que o formato de arquivo de entrada é \s-1UTF\-16LE.\s0
.Sp
Quando há uma marca de ordem de byte no arquivo de entrada, esta tem
prioridade sobre essa opção.
.Sp
Quando você fizer uma presunção equivocada (o arquivo de entrada não estava
no formato \s-1UTF\-16LE\s0) e a conversão funcionar, você terá um arquivo de saída
\&\s-1UTF\-8\s0 com texto errado. Você pode desfazer a conversão errada com \fIiconv\fR\|(1)
pela conversão do arquivo de saída \s-1UTF\-8\s0 de volta para \s-1UTF\-16LE.\s0 Isso vai
trazer de volta o arquivo para o original.
.Sp
A presunção de \s-1UTF\-16LE\s0 funciona como um \fImodo de conversão\fR. Ao alternara
o modo \fIascii\fR padrão, a presunção de \s-1UTF\-16LE\s0 é desativada.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Presume que o formato de arquivo de entrada é \s-1UTF\-16BE.\s0
.Sp
Essa opção funciona o mesmo que a opção \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Exibe mensagens detalhadas. Informação extra é exibida sobre marcas de ordem
de byte e a quantidade de quebras de linha convertidas.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Segue ligações simbólicas e converte os alvos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Substitui ligações simbólicas com arquivos convertidos (arquivos alvo
originais permanecem inalterados).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Mentém ligações simbólicas e alvos inalterados (padrão).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Exibe informação da versão e sai.
.SH "MODO MAC"
.IX Header "MODO MAC"
No modo normal, as quebras de linhas são convertidas de \s-1DOS\s0 para Unix e
vice-versa. Quebras de linha do Mac não são convertidas.
.PP
No modo Mac, quebras de linha são convertidas de Mac para Unix e
vice-versa. Quebras de linha do \s-1DOS\s0 não são alteradas.
.PP
Para executar no modo Mac, use a opção de linha de comando \f(CW\*(C`\-c mac\*(C'\fR ou use
os comandos \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSÃO"
.IX Header "MODOS DE CONVERSÃO"
.IP "\fBascii\fR" 4
.IX Item "ascii"
No modo \f(CW\*(C`ascii\*(C'\fR, apenas as quebras de linha são convertidas. Esse é o modo
de conversão padrão.
.Sp
Apesar do nome deste modo ser \s-1ASCII,\s0 o qual é um padrão de 7 bit, o modo é
em verdade 8 bit. Sempre use este modo quando quiser converter arquivos
Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Neste modo todos os caracteres não\-ASCII de 8 bit (com valores entre 128 e
255) são convertidos para um espaço de 7 bit.
.IP "\fBiso\fR" 4
.IX Item "iso"
Caracteres são convertidos entre um conjunto de caracteres do \s-1DOS \s0(página de
código) e conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latin\-1) no Unix. Caracteres de
\&\s-1DOS\s0 sem um equivalente \s-1ISO\-8859\-1,\s0 para os quais a conversão não é possível,
são convertidos para um ponto. O mesmo vale para caracteres \s-1ISO\-8859\-1\s0 sem a
contraparte \s-1DOS.\s0
.Sp
Quando apenas a opção \f(CW\*(C`\-iso\*(C'\fR for usada, dos2unix vai tentar determinar a
página de código ativa. Quando isso não for possível, dos2unix vai usar a
página de código padrão \s-1CP437,\s0 a qual é usada principalmente nos \s-1EUA.\s0 Para
forçar uma página de código específica, use as opções \f(CW\*(C`\-437\*(C'\fR (\s-1EUA\s0), \f(CW\*(C`\-850\*(C'\fR
(Europeu oriental), \f(CW\*(C`\-860\*(C'\fR (Português), \f(CW\*(C`\-863\*(C'\fR (Franco-canadense) ou
\&\f(CW\*(C`\-865\*(C'\fR (Nórdico). Também há suporte à página de código do Windows \s-1CP1252
\&\s0(Europeu ocidental) com a opção \f(CW\*(C`\-1252\*(C'\fR. Para outras páginas de código, use
dos2unix em combinação cm \fIiconv\fR\|(1). Iconv pode converter entre uma lista
grande de codificações de caracteres.
.Sp
Nunca use conversão \s-1ISO\s0 em arquivos textos Unicode. Isso vai corromper os
arquivos codificados em \s-1UTF\-8.\s0
.Sp
Alguns exemplos:
.Sp
Conversão da página de código padrão do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP850\s0 do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para \s-1UTF\-8 \s0(Unicode) do Unix:
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrada.txt | dos2unix > saída.txt
.Ve
.Sp
Conversão de Latin\-1 do Unix para página de código padrão do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do Unix para \s-1CP850\s0 do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do \s-1UTF\-8 \s0(Unicode) do Unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t CP1252 > saída.txt
.Ve
.Sp
Veja também <http://czyborra.com/charsets/codepages.html> e
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificações"
.IX Subsection "Codificações"
Exitem codificações Unicode diferentes. No Unix e no Linux, arquivos Unicode
são geralmente codificados em \s-1UTF\-8.\s0 No Windows, arquivos texto Unicode
podem ser codificados em \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 big endian, mas na maioria
das vezes são codificados no formato \s-1UTF\-16.\s0
.SS "Conversão"
.IX Subsection "Conversão"
Arquivos texto em Unicode pode ter quebras de linha \s-1DOS,\s0 Unix ou Mac, como
arquivos texto comuns.
.PP
Todas as versões do dos2unix e unix2dos podem converter arquivos codificados
em \s-1UTF\-8\s0 porque \s-1UTF\-8\s0 foi projetado para ter compatibilidade reversa com
\&\s-1ASCII.\s0
.PP
Dos2unix e unix2dos com suporte a Unicode \s-1UTF\-16\s0 podem ler arquivos texto
codificados em little e big endian \s-1UTF\-16.\s0 Para ver se dos2unix foi
compilado com suporte a \s-1UTF\-16,\s0 digite \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
No Unix/Linux, arquivos codificados em \s-1UTF\-16\s0 são convertidos para a
codificação de caracteres do localização. Use o comando \fIlocale\fR\|(1) para
descobrir qual é a codificação de caracteres da localização. Quando a
conversão não for possível, ocorrerá um erro e o arquivo será ignorado.
.PP
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para
\&\s-1UTF\-8.\s0 Arquivos texto formatados em \s-1UTF\-8\s0 possuem ótimo suporte em ambos
Windows e Unix/Linux.
.PP
Codificações \s-1UTF\-16\s0 e \s-1UTF\-8\s0 são completamente compatíveis, não havendo
qualquer perda de texto na conversão. Quando um erro de conversão \s-1UTF\-16\s0
para \s-1UTF\-8\s0 ocorre, por exemplo quando o arquivo de entrada \s-1UTF\-16 \s0 contém um
erro, o arquivo será ignorado.
.PP
Quando a opção \f(CW\*(C`\-u\*(C'\fR é usada, o arquivo de saída será escrito na mesma
codificação \s-1UTF\-16\s0 que o arquivo de saída. A opção \f(CW\*(C`\-u\*(C'\fR evita conversão
para \s-1UTF\-8.\s0
.PP
Dos2unix e unix2dos não possuem opção para converter arquivos \s-1UTF\-8\s0 ára
\&\s-1UTF\-16.\s0
.PP
Modo de conversão \s-1ISO\s0 e 7\-bit não funciona em arquivos \s-1UTF\-16.\s0
.SS "Marca de ordem de byte"
.IX Subsection "Marca de ordem de byte"
No Windows, arquivos Unicode normalmente têm uma Marca de Ordem de Byte
(\s-1BOM\s0), porque muitos programas (incluindo o Bloco de Notas) adiciona BOMs
por padrão. Veja também <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
No Unix, arquivos Unicode normalmente não têm \s-1BOM.\s0 Presume-se que arquivos
texto são codificados na codificação de caracteres da localização.
.PP
Dos2unix pode detectar apenas se um arquivo está no formato \s-1UTF\-16\s0 se o
arquivo tiver \s-1BOM.\s0 Quando um arquivo \s-1UTF\-16\s0 não tiver \s-1BOM,\s0 dos2unix vai ver
se o arquivo é um arquivo binário.
.PP
Use a opção \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR para converter um arquivo \s-1UTF\-16\s0 sem \s-1BOM.\s0
.PP
Dos2unix escreve por padrão nenhum \s-1BOM\s0 no arquivo de saída. Com a opção
\&\f(CW\*(C`\-b\*(C'\fR, o Dos2unix escreve um \s-1BOM\s0 quando o arquivo de entrada possuir \s-1BOM.\s0
.PP
Unix2dos escreve por padrão um \s-1BOM\s0 no arquivo de saída quando o arquivo de
entrada tem \s-1BOM.\s0 Use a opção \f(CW\*(C`\-m\*(C'\fR para remover \s-1BOM.\s0
.PP
Dos2unix e unix2dos sempre escrevem \s-1BOM\s0 quando a opção \f(CW\*(C`\-m\*(C'\fR é usada.
.SS "Exemplos de Unicode"
.IX Subsection "Exemplos de Unicode"
Conversão de \s-1UTF\-16\s0 do Windows (com \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-16LE\s0 do Windows (sem \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 Unix para \s-1UTF\-8\s0 do Windows com \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 do Unix para \s-1UTF\-16\s0 do Windows:
.PP
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t UTF\-16 > saída.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 é um padrão governamental chinês. Um subconjunto obrigatório do
padrão \s-1GB18030\s0 é exigido oficialmente para todos os produtos de software
vendidos na China. Veja também <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 é completamente compatível com Unicode e pode ser considerado um
formato de transformação de unicode. Assim como \s-1UTF\-8, GB18030\s0 é compatível
com \s-1ASCII. GB18030\s0 também é compatível com a página de código 936 do
Windows, também conhecida como \s-1GBK.\s0
.PP
No Unix/Linux, arquivos \s-1UTF\-16\s0 são convertidos para \s-1GB18030\s0 quando a
codificação da localização é definida para \s-1GB18030.\s0 Note que isso vai
funcionar apenas se a localização estiver definida para China. Por exemplo,
em uma configuração de localização inglesa (Britânia) a conversão
\&\f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0 para \s-1GB18030\s0 não vai funcionar, mas em uma
configuração de localização \f(CW\*(C`zh_CN.GB18030\*(C'\fR chinesa vai funcionar.
.PP
No Windows, você precisa usar a opção \f(CW\*(C`\-gb\*(C'\fR para converter arquivos \s-1UTF\-16\s0
para \s-1GB18030.\s0
.PP
Arquivos codificados em \s-1GB18030\s0 possuem uma marca de ordem de bytes, como
arquivos Unicode.
.SH "EXEMPLOS"
.IX Header "EXEMPLOS"
Lê a entrada da \*(L"stdin\*(R" e escreve a saída para \*(L"stdout\*(R":
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Converte e substitui a.txt. Converte e substitui b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii. Converte e substitui
b.txt no modo de conversão 7bit:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Converte a.txt do formato do Mac para Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Converte a.txt do formato do Unix para Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Converte e substitui a.txt enquanto mantém a marca de data original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Converte a.txt e escreve para e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Converte a.txt e escreve para e.txt, mantém a marca de data de e.txt igual a
a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Converte e substitui a.txt. Converte b.txt e escreve para e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Converte c.txt e escreve para e.txt. Converte e substitui a.txt. Converte e
substitui b.txt. Converte d.txt e escreve para f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "Conversão recursiva"
.IX Header "Conversão recursiva"
Use dos2unix em combinação com os comandos \fIfind\fR\|(1) e \fIxargs\fR\|(1) para converter
recursivamente arquivos texto em uma estrutura de árvore de diretórios. Por
exemplo, para converter todos os arquivos .txt na árvore de diretórios sob o
diretório atual, digite:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZAÇÃO"
.IX Header "LOCALIZAÇÃO"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
O idioma primário é selecionado com a variável de ambiente \s-1LANG. A\s0 variável
\&\s-1LANG\s0 consiste em várias partes. A primeira parte está em letras pequenas no
código do idioma. A segunda parte é opcional e é o código do país em letras
maiúsculo, precedido de um ponto. Alguns exemplos para shells do tipo padrão
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl Holandês
\& export LANG=nl_NL Holandês, Holanda
\& export LANG=nl_BE Holandês, Bélgica
\& export LANG=es_ES Espanhol, Espanha
\& export LANG=es_MX Espanhol, México
\& export LANG=en_US.iso88591 Inglês, EUA, codificação Latin\-1
\& export LANG=en_GB.UTF\-8 Inglês, Reino Unido, codificação UTF\-8
.Ve
.Sp
Para a lista completa de códigos de idioma e país, veja o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Nos sistemas Unix, você pode usar o comando \fIlocale\fR\|(1) para obter informação
específica da localização.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Com a variável de ambiente \s-1LANGUAGE,\s0 você pode especificar uma lista de
prioridades de idiomas, separada por vírgulas. Dos2unix fornece preferência
à \s-1LANGUAGE\s0 sobre \s-1LANG.\s0 Por exemplo, primeiro holandês e, então, alemão:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Você primeiro tem que habilitar localização, definindo
\&\s-1LANG \s0(ou \s-1LC_ALL\s0) para um valor diferente de \*(L"C\*(R", antes que você possa usar
uma lista de prioridade de idioma por meio da variável \s-1LANGUAGE.\s0 Veja também
o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Se você selecionou um idioma que não está disponível, você vai terá as
mensagens em inglês (padrão).
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Com a variável de ambiente \s-1DOS2UNIX_LOCALEDIR,\s0 o \s-1LOCALEDIR\s0 definido durante
a compilação pode ser sobrescrito. \s-1LOCALEDIR\s0 é usada para localizar os
arquivos de idioma. O valor padrão do \s-1GNU\s0 é \f(CW\*(C`/usr/local/share/locale\*(C'\fR. A
opção \fB\-\-version\fR vai exibir o \s-1LOCALEDIR\s0 que é usado.
.Sp
Exemplo (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR RETORNADO"
.IX Header "VALOR RETORNADO"
No sucesso, zero é retornado. Quando um erro de sistema ocorre, o último
erro de sistema será retornado. Para outros erros, 1 é retornado.
.PP
O valor retornado é sempre zero no modo quieto, exceto quando opções de
linha de comando erradas são usadas.
.SH "PADRÕES"
.IX Header "PADRÕES"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au> Bernd Johannes Wuebben (modo mac2unix)
\&\- <wuebben@kde.org>, Christian Wurll (adiciona nova linha extra) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (mantenedor)
.PP
Página do projeto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página do SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "Veja também"
.IX Header "Veja também"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,754 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NOME"
.IX Header "NOME"
dos2unix \- Conversor de formato de arquivo texto de DOS/Mac para Unix e
vice-versa
.SH "SINOPSE"
.IX Header "SINOPSE"
.Vb 2
\& dos2unix [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
\& unix2dos [opções] [ARQUIVO ...] [\-n ARQENT ARQSAÍDA ...]
.Ve
.SH "DESCRIÇÃO"
.IX Header "DESCRIÇÃO"
O pacote Dos2unix inclui utilitários de \f(CW\*(C`dos2unix\*(C'\fR e \f(CW\*(C`unix2dos\*(C'\fR para
converter arquivos texto nos formatos \s-1DOS\s0 ou Mac para formato Unix e
vice-versa.
.PP
Em arquivos texto DOS/Windows uma quebra de linha, também conhecida como
nova linha, é uma combinação de dois caracteres: um Carriage Return (\s-1CR\s0)
seguido por um Line Feed (\s-1LF\s0). Em arquivos texto do Unix uma quebra de linha
é um único caractere: o Line Feed (\s-1LF\s0). Em arquivos texto do Mac, anteriores
ao Mac \s-1OS X,\s0 uma quebra de linha era um único caractere Carriage Return
(\s-1CR\s0). Hoje em dia, Mac \s-1OS\s0 usa quebras de linha no estilo do Unix (\s-1LF\s0).
.PP
Além das quebras de linhas, Dos2unix também pode converter as codificações
de arquivos. Algumas poucas páginas podem ser convertidos para Latin\-1 para
Unix. E arquivos Unicode do Windows (\s-1UTF\-16\s0) podem ser convertidos para
arquivos Unicode do Unix (\s-1UTF\-8\s0).
.PP
Arquivos binários são ignorados automaticamente, a menos que a conversão
seja forçada.
.PP
Arquivos não regulares, tais como diretórios e FIFOs, são ignorados
automaticamente.
.PP
Ligações simbólicas e seus alvos são por padrão mantidas
intocáveis. Ligações simbólicas podem opcionalmente ser substituídas, ou a
saída pode ser escrita para o alvo das ligações simbólicas. Não há suporte
às ligações simbólicas do Windows.
.PP
Dos2unix foi modelado seguindo dos2unix do SunOS/Solaris. Há uma diferença
importante em relação à versão original do SunOS/Solaris. Essa versão faz
conversão no-lugar (modo arquivo antigo) por padrão, enquanto a versão
original do SunOS/Solaris fornecia suporte apenas a conversão pareada (modo
de novo arquivo). Veja também as opções \f(CW\*(C`\-o\*(C'\fR e \f(CW\*(C`\-n\*(C'\fR.
.SH "OPÇÕES"
.IX Header "OPÇÕES"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Trata as opções seguintes como nomes de arquivos. Use essa opção se você
quiser converter arquivos cujos nomes iniciam com um traço. Por exemplo,
para converter um arquivo chamado \*(L"foo\*(R", você pode usar este comando:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Ou em modo de novo arquivo:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo saída.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Converte apenas as quebras de linhas. Esse é o modo de conversão padrão.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Conversão entre conjunto de caractere do \s-1DOS\s0 e \s-1ISO\-8859\-1.\s0 Veja também a
seção \s-1MODOS DE\s0 CONVERSÃO.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Usa a página de código 1252 do Windows (Europa ocidental).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Usa a página de código 437 do \s-1DOS \s0(\s-1EUA\s0). Essa é a página de código padrão
usada para conversão \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Usa a página de código 850 do \s-1DOS \s0(Europa ocidental).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Usa a página de código 860 do \s-1DOS \s0(Português).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Usa a página de código 863 do \s-1DOS \s0(Francês do Canadá).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Usa a página de código 865 do \s-1DOS \s0(Nórdico).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Converte caracteres de 8 bit para espaço de 7 bit.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Mantém marca de ordem de bytes (\s-1BOM\s0). Quando o arquivo de entrada possuir um
\&\s-1BOM,\s0 escreve um \s-1BOM\s0 no arquivo de saída. Esse é o comportamento padrão ao
converter para quebras de linha do \s-1DOS.\s0 Veja também a opção \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode \s-1MODOCONV\s0\fR" 4
.IX Item "-c, --convmode MODOCONV"
Define o modo de conversão, sendo \s-1MODOCONV\s0 um dentre: \fIascii\fR, \fI7bit\fR,
\&\fIiso\fR, \fImac\fR com ascii sendo o padrão.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Força a conversão de arquivos binários.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para \s-1UTF\-8,\s0
independentemente da localização definida. Use esta opção para converter
arquivos \s-1UTF\-16\s0 para \s-1GB18030.\s0 Essa opção está disponível apenas no
Windows. Veja também a seção \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Exibe ajuda e sai.
.IP "\fB\-i[OPÇÕES], \-\-info[=OPÇÕES] \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-i[OPÇÕES], --info[=OPÇÕES] ARQUIVO ..."
Exibe informação do arquivo. Nenhuma conversão é feita.
.Sp
A seguinte informação é exibida, nesta ordem: número de quebras de linha do
\&\s-1DOS,\s0 número de quebras de linha do Unix, número de quebras de linha do Mac,
marca de ordem de byte, \*(L"text\*(R" ou \*(L"binário\*(R", nome de arquivo.
.Sp
Saída de exemplo:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Opcionalmente, opções extra podem ser definidas para alterar a saída. Uma ou
mais opções podem ser adicionadas.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Exibe o número de quebras de linhas do \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Exibe o número de quebras de linhas do Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Exibe o número de quebras de linhas do Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Exibe a marca de ordem de byte.
.IP "\fBt\fR" 4
.IX Item "t"
Exibe se arquivo é texto ou binário.
.IP "\fBc\fR" 4
.IX Item "c"
Exib apenas os arquivos que seriam convertidos.
.Sp
Com a opção \f(CW\*(C`c\*(C'\fR, dos2unix vai exibir apenas os arquivos que contêm quebras
de linha do \s-1DOS,\s0 unix2dos vai exibir apenas os nomes de arquivos que contêm
quebras de linha do Unix.
.RE
.RS 4
.Sp
Exemplos:
.Sp
Mostra informação sobre todos os arquivos *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Mostra apenas o número de quebras de linha \s-1DOS\s0 e Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Mostra apenas a marca de ordem de byte:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Lista os arquivos que possuem quebras de linha do Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Mantém a marca da data do arquivo de saída igual ao do arquivo de entrada.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Exibe a licença do programa.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Adiciona nova linha adicional.
.Sp
\&\fBdos2unix\fR: Apenas quebras de linha do \s-1DOS\s0 são alteradas para duas quebras
de linha do Unix. No modo Mac, apenas quebras de linha do Mac são alterados
para duas quebras de linha do Unix.
.Sp
\&\fBunix2dos\fR: Apenas quebras de linha do Unix são alteradas para duas quebras
de linha do \s-1DOS.\s0 No modo Mac, quebras de linha do Unix são alteradas para
duas quebras de linha do Mac.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Escreve uma marca de ordem de byte (\s-1BOM\s0) no arquivo de saída. Por padrão, um
\&\s-1BOM UTF\-8\s0 é escrito.
.Sp
Quando o arquivo de entrada é \s-1UTF\-16,\s0 e a opção \f(CW\*(C`\-u\*(C'\fR é usada, um \s-1BOM UTF\-16\s0
será escrito.
.Sp
Nunca use essa opção quando a codificação de saída é outra além de \s-1UTF\-8\s0 ou
\&\s-1UTF\-16.\s0 Veja também a seção \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile \s-1ARQENT\s0 ARQSAÍDA ...\fR" 4
.IX Item "-n, --newfile ARQENT ARQSAÍDA ..."
Modo de novo arquivo. Converte o arquivo \s-1ARQENT\s0 e escreve a saída para o
arquivo ARQSAÍDA. Os nomes de arquivos devem ser fornecidos em pares e nome
coringa \fInão\fR deveriam ser usados ou você \fIvai\fR perder seus arquivos.
.Sp
A pessoa que começa a conversão em modo novo arquivo (pareado) será o dono
do arquivo convertido. As permissões de leitura/escrita do novo arquivo
serão as permissões do arquivo original menos a \fIumask\fR\|(1) da pessoa que
executa a conversão.
.IP "\fB\-o, \-\-oldfile \s-1ARQUIVO ...\s0\fR" 4
.IX Item "-o, --oldfile ARQUIVO ..."
Modo arquivo antigo. Converte o arquivo \s-1ARQUIVO\s0 e o sobrescreve com a
saída. O programa, por padrão, executa neste modo. Nomes coringas podem ser
usados.
.Sp
No modo de arquivo antigo (no-lugar) o arquivo convertido recebe no mesmo
dono, grupo e permissões de leitura/escrita que o arquivo original. Também,
quando o arquivo é convertido por outro usuário que tenha permissões de
escrita no arquivo (ex.: usuário root). A conversão será abortada quando não
for possível preservar os valores originais. Alteração do dono pode
significar que o dono original não é mais capaz de ler o arquivo. Alteração
do grupo pode ser um risco para a segurança, pois o arquivo pode ficar
legível para pessoas cujo acesso não é desejado. Preservação do dono, grupo
e permissões de leitura/escrita tem suporte apenas no Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Modo quieto. Suprime todos os avios e mensagens. O valor retornado é
zero. Exceto quando opções de linha de comando erradas forem usadas.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
remove marca de ordem de bytes (\s-1BOM\s0). Não escreve um \s-1BOM\s0 no arquivo de
saída. Esse é o comportamento padrão ao converter para quebras de linha
Unix. Veja também a opção \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Ignora arquivo binários (padrão).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Mantém a codificação \s-1UTF\-16\s0 original do arquivo de entrada. O arquivo de
saída será escrito na mesma codificação \s-1UTF\-16,\s0 em little ou big endian,
como o arquivo de entrada. Isso evita transformação para \s-1UTF\-8.\s0 Como
consequência, um \s-1BOM UTF\-16\s0 será escrito. Essa opção pode ser desabilitada
com a opção \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Presume que o formato de arquivo de entrada é \s-1UTF\-16LE.\s0
.Sp
Quando há uma marca de ordem de byte no arquivo de entrada, esta tem
prioridade sobre essa opção.
.Sp
Quando você fizer uma presunção equivocada (o arquivo de entrada não estava
no formato \s-1UTF\-16LE\s0) e a conversão funcionar, você terá um arquivo de saída
\&\s-1UTF\-8\s0 com texto errado. Você pode desfazer a conversão errada com \fIiconv\fR\|(1)
pela conversão do arquivo de saída \s-1UTF\-8\s0 de volta para \s-1UTF\-16LE.\s0 Isso vai
trazer de volta o arquivo para o original.
.Sp
A presunção de \s-1UTF\-16LE\s0 funciona como um \fImodo de conversão\fR. Ao alternara
o modo \fIascii\fR padrão, a presunção de \s-1UTF\-16LE\s0 é desativada.
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Presume que o formato de arquivo de entrada é \s-1UTF\-16BE.\s0
.Sp
Essa opção funciona o mesmo que a opção \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Exibe mensagens detalhadas. Informação extra é exibida sobre marcas de ordem
de byte e a quantidade de quebras de linha convertidas.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Segue ligações simbólicas e converte os alvos.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Substitui ligações simbólicas com arquivos convertidos (arquivos alvo
originais permanecem inalterados).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Mentém ligações simbólicas e alvos inalterados (padrão).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Exibe informação da versão e sai.
.SH "MODO MAC"
.IX Header "MODO MAC"
No modo normal, as quebras de linhas são convertidas de \s-1DOS\s0 para Unix e
vice-versa. Quebras de linha do Mac não são convertidas.
.PP
No modo Mac, quebras de linha são convertidas de Mac para Unix e
vice-versa. Quebras de linha do \s-1DOS\s0 não são alteradas.
.PP
Para executar no modo Mac, use a opção de linha de comando \f(CW\*(C`\-c mac\*(C'\fR ou use
os comandos \f(CW\*(C`mac2unix\*(C'\fR ou \f(CW\*(C`unix2mac\*(C'\fR.
.SH "MODOS DE CONVERSÃO"
.IX Header "MODOS DE CONVERSÃO"
.IP "\fBascii\fR" 4
.IX Item "ascii"
No modo \f(CW\*(C`ascii\*(C'\fR, apenas as quebras de linha são convertidas. Esse é o modo
de conversão padrão.
.Sp
Apesar do nome deste modo ser \s-1ASCII,\s0 o qual é um padrão de 7 bit, o modo é
em verdade 8 bit. Sempre use este modo quando quiser converter arquivos
Unicode \s-1UTF\-8.\s0
.IP "\fB7bit\fR" 4
.IX Item "7bit"
Neste modo todos os caracteres não\-ASCII de 8 bit (com valores entre 128 e
255) são convertidos para um espaço de 7 bit.
.IP "\fBiso\fR" 4
.IX Item "iso"
Caracteres são convertidos entre um conjunto de caracteres do \s-1DOS \s0(página de
código) e conjunto de caracteres \s-1ISO\-8859\-1 \s0(Latin\-1) no Unix. Caracteres de
\&\s-1DOS\s0 sem um equivalente \s-1ISO\-8859\-1,\s0 para os quais a conversão não é possível,
são convertidos para um ponto. O mesmo vale para caracteres \s-1ISO\-8859\-1\s0 sem a
contraparte \s-1DOS.\s0
.Sp
Quando apenas a opção \f(CW\*(C`\-iso\*(C'\fR for usada, dos2unix vai tentar determinar a
página de código ativa. Quando isso não for possível, dos2unix vai usar a
página de código padrão \s-1CP437,\s0 a qual é usada principalmente nos \s-1EUA.\s0 Para
forçar uma página de código específica, use as opções \f(CW\*(C`\-437\*(C'\fR (\s-1EUA\s0), \f(CW\*(C`\-850\*(C'\fR
(Europeu oriental), \f(CW\*(C`\-860\*(C'\fR (Português), \f(CW\*(C`\-863\*(C'\fR (Franco-canadense) ou
\&\f(CW\*(C`\-865\*(C'\fR (Nórdico). Também há suporte à página de código do Windows \s-1CP1252
\&\s0(Europeu ocidental) com a opção \f(CW\*(C`\-1252\*(C'\fR. Para outras páginas de código, use
dos2unix em combinação cm \fIiconv\fR\|(1). Iconv pode converter entre uma lista
grande de codificações de caracteres.
.Sp
Nunca use conversão \s-1ISO\s0 em arquivos textos Unicode. Isso vai corromper os
arquivos codificados em \s-1UTF\-8.\s0
.Sp
Alguns exemplos:
.Sp
Conversão da página de código padrão do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP850\s0 do \s-1DOS\s0 para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para Latin\-1 do Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão da \s-1CP1252\s0 do Windows para \s-1UTF\-8 \s0(Unicode) do Unix:
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 entrada.txt | dos2unix > saída.txt
.Ve
.Sp
Conversão de Latin\-1 do Unix para página de código padrão do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do Unix para \s-1CP850\s0 do \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do Latin\-1 do unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos \-1252 \-n entrada.txt saída.txt
.Ve
.Sp
Conversão do \s-1UTF\-8 \s0(Unicode) do Unix para \s-1CP1252\s0 do Windows:
.Sp
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t CP1252 > saída.txt
.Ve
.Sp
Veja também <http://czyborra.com/charsets/codepages.html> e
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Codificações"
.IX Subsection "Codificações"
Exitem codificações Unicode diferentes. No Unix e no Linux, arquivos Unicode
são geralmente codificados em \s-1UTF\-8.\s0 No Windows, arquivos texto Unicode
podem ser codificados em \s-1UTF\-8, UTF\-16\s0 ou \s-1UTF\-16\s0 big endian, mas na maioria
das vezes são codificados no formato \s-1UTF\-16.\s0
.SS "Conversão"
.IX Subsection "Conversão"
Arquivos texto em Unicode pode ter quebras de linha \s-1DOS,\s0 Unix ou Mac, como
arquivos texto comuns.
.PP
Todas as versões do dos2unix e unix2dos podem converter arquivos codificados
em \s-1UTF\-8\s0 porque \s-1UTF\-8\s0 foi projetado para ter compatibilidade reversa com
\&\s-1ASCII.\s0
.PP
Dos2unix e unix2dos com suporte a Unicode \s-1UTF\-16\s0 podem ler arquivos texto
codificados em little e big endian \s-1UTF\-16.\s0 Para ver se dos2unix foi
compilado com suporte a \s-1UTF\-16,\s0 digite \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
No Unix/Linux, arquivos codificados em \s-1UTF\-16\s0 são convertidos para a
codificação de caracteres do localização. Use o comando \fIlocale\fR\|(1) para
descobrir qual é a codificação de caracteres da localização. Quando a
conversão não for possível, ocorrerá um erro e o arquivo será ignorado.
.PP
No Windows, arquivos \s-1UTF\-16\s0 são convertidos, por padrão, para
\&\s-1UTF\-8.\s0 Arquivos texto formatados em \s-1UTF\-8\s0 possuem ótimo suporte em ambos
Windows e Unix/Linux.
.PP
Codificações \s-1UTF\-16\s0 e \s-1UTF\-8\s0 são completamente compatíveis, não havendo
qualquer perda de texto na conversão. Quando um erro de conversão \s-1UTF\-16\s0
para \s-1UTF\-8\s0 ocorre, por exemplo quando o arquivo de entrada \s-1UTF\-16 \s0 contém um
erro, o arquivo será ignorado.
.PP
Quando a opção \f(CW\*(C`\-u\*(C'\fR é usada, o arquivo de saída será escrito na mesma
codificação \s-1UTF\-16\s0 que o arquivo de saída. A opção \f(CW\*(C`\-u\*(C'\fR evita conversão
para \s-1UTF\-8.\s0
.PP
Dos2unix e unix2dos não possuem opção para converter arquivos \s-1UTF\-8\s0 ára
\&\s-1UTF\-16.\s0
.PP
Modo de conversão \s-1ISO\s0 e 7\-bit não funciona em arquivos \s-1UTF\-16.\s0
.SS "Marca de ordem de byte"
.IX Subsection "Marca de ordem de byte"
No Windows, arquivos Unicode normalmente têm uma Marca de Ordem de Byte
(\s-1BOM\s0), porque muitos programas (incluindo o Bloco de Notas) adiciona BOMs
por padrão. Veja também <http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
No Unix, arquivos Unicode normalmente não têm \s-1BOM.\s0 Presume-se que arquivos
texto são codificados na codificação de caracteres da localização.
.PP
Dos2unix pode detectar apenas se um arquivo está no formato \s-1UTF\-16\s0 se o
arquivo tiver \s-1BOM.\s0 Quando um arquivo \s-1UTF\-16\s0 não tiver \s-1BOM,\s0 dos2unix vai ver
se o arquivo é um arquivo binário.
.PP
Use a opção \f(CW\*(C`\-ul\*(C'\fR ou \f(CW\*(C`\-ub\*(C'\fR para converter um arquivo \s-1UTF\-16\s0 sem \s-1BOM.\s0
.PP
Dos2unix escreve por padrão nenhum \s-1BOM\s0 no arquivo de saída. Com a opção
\&\f(CW\*(C`\-b\*(C'\fR, o Dos2unix escreve um \s-1BOM\s0 quando o arquivo de entrada possuir \s-1BOM.\s0
.PP
Unix2dos escreve por padrão um \s-1BOM\s0 no arquivo de saída quando o arquivo de
entrada tem \s-1BOM.\s0 Use a opção \f(CW\*(C`\-m\*(C'\fR para remover \s-1BOM.\s0
.PP
Dos2unix e unix2dos sempre escrevem \s-1BOM\s0 quando a opção \f(CW\*(C`\-m\*(C'\fR é usada.
.SS "Exemplos de Unicode"
.IX Subsection "Exemplos de Unicode"
Conversão de \s-1UTF\-16\s0 do Windows (com \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-16LE\s0 do Windows (sem \s-1BOM\s0) para \s-1UTF\-8\s0 do Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 Unix para \s-1UTF\-8\s0 do Windows com \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n entrada.txt saída.txt
.Ve
.PP
Conversão de \s-1UTF\-8\s0 do Unix para \s-1UTF\-16\s0 do Windows:
.PP
.Vb 1
\& unix2dos < entrada.txt | iconv \-f UTF\-8 \-t UTF\-16 > saída.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 é um padrão governamental chinês. Um subconjunto obrigatório do
padrão \s-1GB18030\s0 é exigido oficialmente para todos os produtos de software
vendidos na China. Veja também <http://en.wikipedia.org/wiki/GB_18030>.
.PP
\&\s-1GB18030\s0 é completamente compatível com Unicode e pode ser considerado um
formato de transformação de unicode. Assim como \s-1UTF\-8, GB18030\s0 é compatível
com \s-1ASCII. GB18030\s0 também é compatível com a página de código 936 do
Windows, também conhecida como \s-1GBK.\s0
.PP
No Unix/Linux, arquivos \s-1UTF\-16\s0 são convertidos para \s-1GB18030\s0 quando a
codificação da localização é definida para \s-1GB18030.\s0 Note que isso vai
funcionar apenas se a localização estiver definida para China. Por exemplo,
em uma configuração de localização inglesa (Britânia) a conversão
\&\f(CW\*(C`en_GB.GB18030\*(C'\fR de \s-1UTF\-16\s0 para \s-1GB18030\s0 não vai funcionar, mas em uma
configuração de localização \f(CW\*(C`zh_CN.GB18030\*(C'\fR chinesa vai funcionar.
.PP
No Windows, você precisa usar a opção \f(CW\*(C`\-gb\*(C'\fR para converter arquivos \s-1UTF\-16\s0
para \s-1GB18030.\s0
.PP
Arquivos codificados em \s-1GB18030\s0 possuem uma marca de ordem de bytes, como
arquivos Unicode.
.SH "EXEMPLOS"
.IX Header "EXEMPLOS"
Lê a entrada da \*(L"stdin\*(R" e escreve a saída para \*(L"stdout\*(R":
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Converte e substitui a.txt. Converte e substitui b.txt:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Converte e substitui a.txt no modo de conversão ascii. Converte e substitui
b.txt no modo de conversão 7bit:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Converte a.txt do formato do Mac para Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Converte a.txt do formato do Unix para Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Converte e substitui a.txt enquanto mantém a marca de data original:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Converte a.txt e escreve para e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Converte a.txt e escreve para e.txt, mantém a marca de data de e.txt igual a
a.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Converte e substitui a.txt. Converte b.txt e escreve para e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Converte c.txt e escreve para e.txt. Converte e substitui a.txt. Converte e
substitui b.txt. Converte d.txt e escreve para f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "Conversão recursiva"
.IX Header "Conversão recursiva"
Use dos2unix em combinação com os comandos \fIfind\fR\|(1) e \fIxargs\fR\|(1) para converter
recursivamente arquivos texto em uma estrutura de árvore de diretórios. Por
exemplo, para converter todos os arquivos .txt na árvore de diretórios sob o
diretório atual, digite:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "LOCALIZAÇÃO"
.IX Header "LOCALIZAÇÃO"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
O idioma primário é selecionado com a variável de ambiente \s-1LANG. A\s0 variável
\&\s-1LANG\s0 consiste em várias partes. A primeira parte está em letras pequenas no
código do idioma. A segunda parte é opcional e é o código do país em letras
maiúsculo, precedido de um ponto. Alguns exemplos para shells do tipo padrão
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=nl Holandês
\& export LANG=nl_NL Holandês, Holanda
\& export LANG=nl_BE Holandês, Bélgica
\& export LANG=es_ES Espanhol, Espanha
\& export LANG=es_MX Espanhol, México
\& export LANG=en_US.iso88591 Inglês, EUA, codificação Latin\-1
\& export LANG=en_GB.UTF\-8 Inglês, Reino Unido, codificação UTF\-8
.Ve
.Sp
Para a lista completa de códigos de idioma e país, veja o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
Nos sistemas Unix, você pode usar o comando \fIlocale\fR\|(1) para obter informação
específica da localização.
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
Com a variável de ambiente \s-1LANGUAGE,\s0 você pode especificar uma lista de
prioridades de idiomas, separada por vírgulas. Dos2unix fornece preferência
à \s-1LANGUAGE\s0 sobre \s-1LANG.\s0 Por exemplo, primeiro holandês e, então, alemão:
\&\f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Você primeiro tem que habilitar localização, definindo
\&\s-1LANG \s0(ou \s-1LC_ALL\s0) para um valor diferente de \*(L"C\*(R", antes que você possa usar
uma lista de prioridade de idioma por meio da variável \s-1LANGUAGE.\s0 Veja também
o manual do gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Se você selecionou um idioma que não está disponível, você vai terá as
mensagens em inglês (padrão).
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Com a variável de ambiente \s-1DOS2UNIX_LOCALEDIR,\s0 o \s-1LOCALEDIR\s0 definido durante
a compilação pode ser sobrescrito. \s-1LOCALEDIR\s0 é usada para localizar os
arquivos de idioma. O valor padrão do \s-1GNU\s0 é \f(CW\*(C`/usr/local/share/locale\*(C'\fR. A
opção \fB\-\-version\fR vai exibir o \s-1LOCALEDIR\s0 que é usado.
.Sp
Exemplo (shell \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "VALOR RETORNADO"
.IX Header "VALOR RETORNADO"
No sucesso, zero é retornado. Quando um erro de sistema ocorre, o último
erro de sistema será retornado. Para outros erros, 1 é retornado.
.PP
O valor retornado é sempre zero no modo quieto, exceto quando opções de
linha de comando erradas são usadas.
.SH "PADRÕES"
.IX Header "PADRÕES"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://en.wikipedia.org/wiki/Carriage_return>
.PP
<http://en.wikipedia.org/wiki/Newline>
.PP
<http://en.wikipedia.org/wiki/Unicode>
.SH "AUTORES"
.IX Header "AUTORES"
Benjamin Lin \- <blin@socs.uts.edu.au> Bernd Johannes Wuebben (modo mac2unix)
\&\- <wuebben@kde.org>, Christian Wurll (adiciona nova linha extra) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (mantenedor)
.PP
Página do projeto: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Página do SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "Veja também"
.IX Header "Veja também"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,796 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "НАЗВА"
.IX Header "НАЗВА"
dos2unix \- програма для перетворення даних у текстовому форматі DOS/Mac у
формат Unix, і навпаки
.SH "КОРОТКИЙ ОПИС"
.IX Header "КОРОТКИЙ ОПИС"
.Vb 2
\& dos2unix [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
\& unix2dos [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
.Ve
.SH "ОПИС"
.IX Header "ОПИС"
До складу пакунка Dos2unix включено програми \f(CW\*(C`dos2unix\*(C'\fR та \f(CW\*(C`unix2dos\*(C'\fR,
призначені для перетворення звичайних текстових даних у форматі \s-1DOS\s0 або Mac
на дані у форматі Unix, і навпаки.
.PP
У текстових файлах DOS/Windows розрив рядка або перехід на новий рядок
здійснюється за допомогою комбінації двох символів: повернення каретки (\s-1CR\s0)
і переведення рядка (\s-1LF\s0). У текстових файлах Unix за перехід на новий рядок
відповідає один символ: переведення рядка (\s-1LF\s0). У текстових файлах Mac, до
Mac \s-1OS X,\s0 за розрив рядка відповідав один символ: повернення каретки (\s-1CR\s0). У
сучасних версіях Mac \s-1OS\s0 використовується типовий для Unix розрив рядка (\s-1LF\s0).
.PP
Окрім символів розриву рядка, програма Dos2unix здатна виконувати
перетворення кодування файлів. Можна перетворити дані у декількох кодуваннях
\&\s-1DOS\s0 на файли у кодуванні Latin\-1 Unix. Також можна перетворити дані у файлах
Windows Unicode (\s-1UTF\-16\s0) на дані у кодуванні Unix Unicode (\s-1UTF\-8\s0).
.PP
Під час перетворення програма пропускатиме двійкові файли, якщо ви не
накажете їй виконати перетворення таких файлів безпосередньо.
.PP
Програма автоматично пропускатиме файли, які не є звичайними файлами,
зокрема каталоги та канали \s-1FIFO.\s0
.PP
Типово, програма не вноситиме змін до символічних посилань та об’єктів
посилань. Якщо потрібно, програма може замінити символічні посилання або
записати перетворені дані до файла\-призначення символічного посилання. У
Windows запису до об’єкта символічного посилання не передбачено.
.PP
Програму dos2unix було створено за зразком програми dos2unix для
SunOS/Solaris. Втім, існує одна важлива відмінність від оригінальної версії
для SunOS/Solaris. Ця версія типово виконує заміну файлів під час
перетворення (старий режим обробки файлів), а у оригінальній версії для
SunOS/Solaris передбачено підтримку лише парного перетворення (новий режим
обробки файлів). Див. також параметри \f(CW\*(C`\-o\*(C'\fR та \f(CW\*(C`\-n\*(C'\fR.
.SH "ПАРАМЕТРИ"
.IX Header "ПАРАМЕТРИ"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Вважати усі наступні параметри назвами файлів. Цим параметром слід
користуватися, якщо вам потрібно виконати перетворення файлів, чиї назви
містять дефіси. Наприклад, щоб виконати перетворення файла «\-foo»,
скористайтеся такою командою:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Або у новому режимі файлів:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Виконати лише перетворення символів розриву рядків. Типовий режим
перетворення.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Виконати перетворення з кодування \s-1DOS\s0 на кодування \s-1ISO\-8859\-1.\s0 Див. розділ
щодо режимів перетворення.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Використати кодову таблицю 1252 Windows (західноєвропейські мови).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Використовувати кодову сторінку \s-1DOS 437 \s0(США). Це типова кодова сторінка для
перетворення \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Використовувати кодову сторінку \s-1DOS 850 \s0(західноєвропейські мови).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Використовувати сторінку \s-1DOS 860 \s0(португальська).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Використовувати сторінку \s-1DOS 863 \s0(канадська французька).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Використовувати сторінку \s-1DOS 865 \s0(скандинавські мови).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Перетворювати 8\-бітові символи на 7\-бітові.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Зберегти позначку порядку байтів (\s-1BOM\s0). Якщо у файлі вхідних даних є \s-1BOM,\s0
записати \s-1BOM\s0 до файла результатів. Це типова поведінка під час перетворення
у формат із символами розриву рядків \s-1DOS.\s0 Див. також параметр \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode РЕЖИМ\fR" 4
.IX Item "-c, --convmode РЕЖИМ"
Встановити режим перетворення. Значенням аргументу РЕЖИМ може бути один з
таких рядків: \fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR. Типовим є режим ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Примусове перетворення двійкових файлів.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
У Windows файли в \s-1UTF\-16\s0 типово перетворюються на файли в \s-1UTF\-8,\s0 незалежно
від встановленої локалі. За допомогою цього параметра ви можете наказати
програмі перетворювати файли в \s-1UTF\-16\s0 на файли у \s-1GB18030.\s0 Цим параметром
можна скористатися лише у Windows. Див. також розділ, присвячений \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Показати довідкові дані і завершити роботу.
.IP "\fB\-i[ПРАПОРЦІ], \-\-info[=ПРАПОРЦІ] ФАЙЛ ...\fR" 4
.IX Item "-i[ПРАПОРЦІ], --info[=ПРАПОРЦІ] ФАЙЛ ..."
Вивести дані щодо файла. Не виконувати перетворення.
.Sp
Буде виведено такі дані, у вказаному порядку: кількість розривів рядків у
форматі \s-1DOS,\s0 кількість розривів рядків у форматі Unix, кількість розривів
рядків у форматі Mac, позначка порядку байтів, текстовим чи бінарним є файл
та назву файла.
.Sp
Приклад результатів:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Крім того, можна вказати додаткові прапорці для внесення змін у виведені
дані. Можна використовувати один або декілька таких прапорців.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Вивести кількість символів розривів рядка \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Вивести кількість символів розривів рядка Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Вивести кількість символів розривів рядка Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Вивести позначку порядку байтів.
.IP "\fBt\fR" 4
.IX Item "t"
Вивести дані щодо того, є файл текстовим чи бінарним.
.IP "\fBc\fR" 4
.IX Item "c"
Вивести дані лише тих файлів, які було б перетворено.
.Sp
Із прапорцем \f(CW\*(C`c\*(C'\fR dos2unix виведе лише назви файлів, у яких містяться
розриви рядків \s-1DOS.\s0 unix2dos виведе лише назви файлів, у яких містяться
розриви рядків Unix.
.RE
.RS 4
.Sp
Приклади:
.Sp
Вивести дані щодо усіх файлів *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Вивести кількість розривів рядків у форматі \s-1DOS\s0 і розривів рядків у форматі
Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Вивести лише позначку порядку байтів:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Вивести список файлів, у яких є символи розриву рядків \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Вивести список файлів, у яких використано символи розриву рядків Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Зберегти часову позначку файла вхідних даних у файлі результатів
перетворення.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Вивести умови ліцензування програми.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Вставити додатковий символ розриву рядка.
.Sp
\&\fBdos2unix\fR: перетворення на два символи розриву рядків Unix відбуватиметься
лише для комбінацій розриву рядків \s-1DOS.\s0 У режимі Mac виконуватиметься
перетворення на два розриви рядків Unix лише символів розриву рядків Mac.
.Sp
\&\fBunix2dos\fR: перетворення на дві комбінації розриву рядків \s-1DOS\s0
відбуватиметься лише для символів розриву рядків \s-1DOS.\s0 У режимі Mac
виконуватиметься перетворення на два розриви рядків Mac лише символів
розриву рядків Unix.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Записати до файла результатів позначку порядку байтів (\s-1BOM\s0). Типово буде
записано позначку порядку байтів \s-1UTF\-8.\s0
.Sp
Якщо дані початкового файла закодовано у \s-1UTF\-16\s0 і використано параметр
\&\f(CW\*(C`\-u\*(C'\fR, буде дописано позначку порядку байтів \s-1UTF\-16.\s0
.Sp
Не використовуйте цей параметр для кодувань результатів, відмінних від \s-1UTF\-8\s0
або \s-1UTF\-16.\s0 Див. також розділ щодо \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...\fR" 4
.IX Item "-n, --newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ..."
Новий режим обробки файлів. Перетворити дані з файла ВХІДНИЙ_ФАЙЛ і записати
результати до файла ВИХІДНИЙ_ФАЙЛ. Назви файлів слід вказувати парами, \fIне
слід\fR використовувати шаблони заміни, інакше вміст файлів \fIбуде втрачено\fR.
.Sp
Власником перетвореного файла буде призначено користувача, яким було
розпочато перетворення у режимі нового файла (парному режимі). Права доступу
на читання або запис нового файла буде визначено на основі прав доступу до
початкового файла мінус \fIumask\fR\|(1) для користувача, яким було розпочато
перетворення.
.IP "\fB\-o, \-\-oldfile ФАЙЛ ...\fR" 4
.IX Item "-o, --oldfile ФАЙЛ ..."
Застарілий режим обробки. Виконати перетворення файла ФАЙЛ і перезаписати
його вміст. Типово, програма працює у цьому режимі. Можна використовувати
шаблони заміни.
.Sp
У застарілому режимі (режимі заміщення) перетворений файл належатиме тому
самому власнику і групі і матиме ті самі права доступу на читання або запис,
що і початковий файл. Крім того, якщо перетворення файла виконується іншим
користувачем, який має права доступу на запис до файла (наприклад
користувачем root), перетворення буде перервано, якщо зберегти початкові
значення не вдасться. Зміна власника може означати неможливість читання
файла для його початкового власника. Зміна групи може призвести до проблем
із безпекою, оскільки файл може стати доступним для читання користувачам,
які не повинні мати такі права доступу. Можливість збереження прав власності
та прав доступу до файла передбачено лише у Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Режим без виведення повідомлень. Програма не виводитиме жодних попереджень
або повідомлень про помилки. Повернутим значенням завжди буде нуль, якщо
вказано правильні параметри командного рядка.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Вилучити позначку порядку байтів (\s-1BOM\s0). Не записувати \s-1BOM\s0 до файла
результатів. Це типова поведінка під час перетворення файлів з форматом
розриву рядків Unix. Див. також параметр \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Пропускати двійкові файли (типово).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Зберегти початкове кодування \s-1UTF\-16.\s0 Файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 із прямим або зворотним порядком байтів, що і
початковий файл. Таким чином можна запобігти перетворенню даних у кодування
\&\s-1UTF\-8.\s0 До файла буде записано відповідну позначку порядку байтів
\&\s-1UTF\-16.\s0 Вимкнути цей параметр можна за допомогою параметра \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Припускати, що кодуванням вхідних файлів є \s-1UTF\-16LE.\s0
.Sp
Якщо у початковому файлі є позначка порядку байтів (\s-1BOM\s0), її буде
використано у файлі\-результаті, незалежно від використання цього параметра.
.Sp
Якщо вами було зроблено помилкове припущення щодо формату файла (файл
вхідних даних насправді не є файлом у форматі \s-1UTF\-16LE\s0), і дані вдасться
успішно перетворити, ви отримаєте файл у кодуванні \s-1UTF\-8\s0 з помилковим
вмістом. Скасувати таке помилкове перетворення можна за допомогою зворотного
перетворення \fIiconv\fR\|(1) з даних у форматі \s-1UTF\-8\s0 на дані у форматі
\&\s-1UTF\-16LE.\s0 Таким чином ви повернетеся до початкового кодування даних у файлі.
.Sp
Припущення щодо форматування \s-1UTF\-16LE\s0 працює як визначення \fIрежиму
перетворення\fR. Перемиканням на типовий режим \fIascii\fR можна вимкнути
припущення щодо форматування \s-1UTF\-16LE.\s0
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Припускати, що вхідним форматом є \s-1UTF\-16BE.\s0
.Sp
Цей параметр працює у спосіб, тотожний до параметра \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Виводити докладні повідомлення. Буде показано додаткові дані щодо позначок
порядку байтів та кількості перетворених символів розриву рядків.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Переходити за символічними посиланням і перетворювати файли, на які вони
вказують.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Замінити символічні посилання перетвореними файлами (початкові файли, на які
вони вказують, змінено не буде).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Не змінювати символічні посилання та файли, на які вони посилаються
(типово).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Вивести дані щодо версії і завершити роботу.
.SH "РЕЖИМ MAC"
.IX Header "РЕЖИМ MAC"
У звичайному режимі розриви рядків \s-1DOS\s0 перетворюються на розриви рядків
Unix, і навпаки. Розриви рядків Mac перетворенню не підлягають.
.PP
У режимі Mac розриви рядків Mac перетворюються на розриви рядків Unix, і
навпаки. Розриви рядків \s-1DOS\s0 перетворенню не підлягають.
.PP
Щоб запустити програму у режимі перетворення Mac, скористайтеся параметром
командного рядка \f(CW\*(C`\-c mac\*(C'\fR або програмами \f(CW\*(C`mac2unix\*(C'\fR та \f(CW\*(C`unix2mac\*(C'\fR.
.SH "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IX Header "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IP "\fBascii\fR" 4
.IX Item "ascii"
У режимі \f(CW\*(C`ascii\*(C'\fR виконуватиметься лише перетворення символів розриву
рядків. Цей режим є типовим режимом перетворення.
.Sp
Хоча цей режим і називається режимом \s-1ASCII \s0(стандарту 7\-бітового кодування),
насправді кодування символів у ньому є 8\-бітовим. Завжди користуйтеся цим
режимом для перетворення файлів у кодуванні \s-1UTF\-8 \s0(Unicode).
.IP "\fB7bit\fR" 4
.IX Item "7bit"
У цьому режимі усі 8\-бітові символи, які не є частиною \s-1ASCII, \s0(з номерами
від 128 до 255) буде перетворено на відповідні 7\-бітові символи.
.IP "\fBiso\fR" 4
.IX Item "iso"
Перетворення символів буде виконано з кодування (кодової сторінки) \s-1DOS\s0 до
кодування \s-1ISO\-8859\-1 \s0(Latin\-1) у Unix. Символи \s-1DOS,\s0 які не мають
еквівалентів у \s-1ISO\-8859\-1\s0 і перетворення яких неможливе, буде перетворено на
символ крапки. Те саме стосується символів \s-1ISO\-8859\-1,\s0 які не мають
еквівалентів у \s-1DOS.\s0
.Sp
Якщо буде використано лише параметр \f(CW\*(C`\-iso\*(C'\fR, програма dos2unix спробує
визначити активне кодування. Якщо це виявиться неможливим, dos2unix
використає типове кодування \s-1CP437,\s0 яке здебільшого використовується у
США. Щоб примусово визначити кодування, скористайтеся параметром \f(CW\*(C`\-437\*(C'\fR
(США), \f(CW\*(C`\-850\*(C'\fR (західноєвропейські мови), \f(CW\*(C`\-860\*(C'\fR (португальська), \f(CW\*(C`\-863\*(C'\fR
(канадська французька) або \f(CW\*(C`\-865\*(C'\fR (скандинавські мови). Використати
кодування Windows \s-1CP1252 \s0(західноєвропейські мови) можна за допомогою
параметра \f(CW\*(C`\-1252\*(C'\fR. Для інших кодувань використовуйте поєднання dos2unix з
\&\fIiconv\fR\|(1). Програма iconv здатна виконувати перетворення даних у доволі
широкому спектрі кодувань символів.
.Sp
Ніколи не користуйтеся перетворенням \s-1ISO\s0 для текстових файлів у форматі
Unicode. Використання подібного перетворення призведе до ушкодження вмісту
файлів у кодуванні \s-1UTF\-8.\s0
.Sp
Декілька прикладів:
.Sp
Перетворити дані у типовому кодуванні \s-1DOS\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1DOS CP850\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP1252\s0 Windows на дані у кодуванні Latin\-1
Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP252\s0 Windows на дані у кодуванні \s-1UTF\-8\s0 Unix
(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у типовому кодуванні \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні Windows
\&\s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix (Unicode) на дані у кодуванні
Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Див. також <http://czyborra.com/charsets/codepages.html> та
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Кодування"
.IX Subsection "Кодування"
Існує декілька різних кодувань Unicode. У Unix та Linux у файлах Unicode
здебільшого використовується кодування \s-1UTF\-8.\s0 У Windows для текстових файлів
Unicode може бути використано кодування \s-1UTF\-8, UTF\-16\s0 або \s-1UTF\-16\s0 зі
зворотним порядком байтів. Втім, здебільшого, використовується формат
\&\s-1UTF\-16.\s0
.SS "Перетворення"
.IX Subsection "Перетворення"
У текстових файлах Unicode, як і у звичайних текстових файлах, може бути
використано розриви рядків \s-1DOS,\s0 Unix або Mac.
.PP
Усі версії dos2unix та unix2dos здатні виконувати перетворення у кодуванні
\&\s-1UTF\-8,\s0 оскільки \s-1UTF\-8\s0 було розроблено так, що зворотну сумісність з \s-1ASCII\s0
збережено.
.PP
Програми dos2unix та unix2dos, зібрані з підтримкою Unicode \s-1UTF\-16,\s0 можуть
читати текстові файли у кодуванні \s-1UTF\-16\s0 з прямим та зворотним порядком
байтів. Щоб дізнатися про те, чи було dos2unix зібрано з підтримкою \s-1UTF\-16,\s0
віддайте команду \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
У Unix/Linux файли у кодуванні \s-1UTF\-16\s0 перетворюються на файли у кодуванні
локалі. Для визначення поточного кодування символів локалі скористайтеся
командою \fIlocale\fR\|(1). Якщо перетворення виявиться неможливим, програма
повідомить про помилку перетворення і пропустить відповідний файл.
.PP
У Windows файли \s-1UTF\-16\s0 типово буде перетворено на файли \s-1UTF\-8.\s0 Обидва типи
систем, Windows та Unix/Linux, мають непогані можливості з підтримки файлів
у форматуванні \s-1UTF\-8.\s0
.PP
Кодування \s-1UTF\-16\s0 та \s-1UTF\-8\s0 є повністю сумісними. Під час перетворення не буде
втрачено жодної інформації. Якщо під час перетворення даних у кодуванні
\&\s-1UTF\-16\s0 на дані у кодуванні \s-1UTF\-8\s0 трапиться помилка, наприклад, якщо у
вхідному файлі \s-1UTF\-16\s0 міститиметься якась помилка, файл буде пропущено.
.PP
Якщо використано параметр \f(CW\*(C`\-u\*(C'\fR, файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 що і початковий файл. Використання параметра Option
\&\f(CW\*(C`\-u\*(C'\fR запобігає перетворенню даних у кодування \s-1UTF\-8.\s0
.PP
У dos2unix та unix2dos не передбачено параметра для перетворення даних у
кодуванні \s-1UTF\-8\s0 на дані у кодуванні \s-1UTF\-16.\s0
.PP
Режим перетворення \s-1ISO\s0 та 7\-бітовий режим не працюють для файлів \s-1UTF\-16.\s0
.SS "Позначка порядку байтів"
.IX Subsection "Позначка порядку байтів"
У Windows до текстових файлів у кодуванні Unicode типово дописується
позначка порядку байтів (\s-1BOM\s0), оскільки багато програм Windows (зокрема
Notepad) додають таку позначку автоматично. Див. також
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
У Unix файли у кодуванні Unicode типово не містять позначки порядку
байтів. Вважається, що кодуванням текстових файлів є те кодування, яке
визначається поточною локаллю.
.PP
Програма dos2unix може визначити, чи є кодуванням файла \s-1UTF\-16,\s0 лише якщо у
файлі міститься позначка порядку байтів. Якщо у файлі, де використано
кодування \s-1UTF\-16,\s0 немає такої позначки, dos2unix вважатиме такий файл
двійковим (бінарним).
.PP
Для перетворення файлів \s-1UTF\-16\s0 без позначки порядку байтів скористайтеся
параметром \f(CW\*(C`\-ul\*(C'\fR або \f(CW\*(C`\-ub\*(C'\fR.
.PP
Типово dos2unix не записує до файлів результатів перетворення позначки
порядку байтів (\s-1BOM\s0). Якщо використано параметр \f(CW\*(C`\-b\*(C'\fR, dos2unix запише до
файла результатів \s-1BOM,\s0 якщо \s-1BOM\s0 була у файлі початкових даних.
.PP
Типово unix2dos записує позначку порядку байтів (\s-1BOM\s0) до файла результатів,
якщо \s-1BOM\s0 є у початковому файлі. Скористайтеся параметром \f(CW\*(C`\-r\*(C'\fR, щоб вилучити
\&\s-1BOM.\s0
.PP
Dos2unix та unix2dos завжди записують до файла результатів позначку порядку
байтів (\s-1BOM\s0), якщо використано параметр \f(CW\*(C`\-m\*(C'\fR.
.SS "Приклади для Unicode"
.IX Subsection "Приклади для Unicode"
Перетворити дані з Windows \s-1UTF\-16 \s0(з позначкою порядку байтів (\s-1BOM\s0)) у
формат Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Перетворити дані у форматі Windows \s-1UTF\-16LE \s0(без \s-1BOM\s0) на дані у форматі
\&\s-1UTF\-8\s0 Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-8\s0
без \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 є китайським урядовим стандартом. Підтримка обов’язкової підмножини
стандарту \s-1GB18030\s0 є неодмінною вимогою до будь\-яких програмних продуктів,
які продаються у Китаї. Див. також <http://en.wikipedia.org/wiki/GB_18030>.
.PP
Кодування \s-1GB18030\s0 є повністю сумісним із Unicode. Його можна розглядати як
формат перетворення unicode. Подібно до \s-1UTF\-8, GB18030\s0 є сумісним із
\&\s-1ASCII. GB18030\s0 також є сумісним із кодовою сторінкою Windows 936, яку ще
називають \s-1GBK.\s0
.PP
У Unix/Linux файли \s-1UTF\-16\s0 буде перетворено до кодування \s-1GB18030,\s0 якщо
кодуванням локалі є \s-1GB18030.\s0 Зауважте, що це спрацює, лише якщо встановлено
значення країни КНР. Наприклад, у англійській локалі для Великоританії із
встановленою локаллю \f(CW\*(C`en_GB.GB18030\*(C'\fR перетворення \s-1UTF\-16\s0 на \s-1GB18030\s0 не
працюватиме, а у китайській локалі \f(CW\*(C`zh_CN.GB18030\*(C'\fR все працюватиме як слід.
.PP
У Windows для перетворення файлів \s-1UTF\-16\s0 на файли \s-1GB18030\s0 слід вказати
параметр \f(CW\*(C`\-gb\*(C'\fR.
.PP
У файлах у кодуванні \s-1GB18030\s0 може міститися позначка порядку байтів, так
само, як у файлах у кодуванні Unicode.
.SH "ПРИКЛАДИ"
.IX Header "ПРИКЛАДИ"
Прочитати вхідні дані зі стандартного джерела (stdin) і записати результат
до стандартного виведення (stdout):
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
замістити цей файл:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення
ascii. Перетворити дані у b.txt і замістити цей файл у режимі 7\-бітового
перетворення:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Перетворити файл a.txt з формату Mac на формат Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Перетворити файл a.txt з формату Unix на формат Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Перетворити дані у a.txt, замістити цей файл і зберегти часову позначку
початкового файла:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла
e.txt. Скопіювати часову позначку файла a.txt для файла e.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
записати результат до e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Перетворити дані у c.txt і записати результати до e.txt. Перетворити дані у
a.txt і замістити ними цей файл. Перетворити дані у b.txt і замістити ними
цей файл. Перетворити дані у d.txt і записати результати до f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
.IX Header "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
Для рекурсивного перетворення текстових файлів у ієрархії каталогів слід
використовувати dos2unix у поєднанні з програмами \fIfind\fR\|(1) та
\&\fIxargs\fR\|(1). Наприклад, щоб виконати перетворення усіх файлів .txt у структурі
підкаталогів поточного каталогу, віддайте таку команду:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "ЛОКАЛІЗАЦІЯ"
.IX Header "ЛОКАЛІЗАЦІЯ"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Основна мова визначається за допомогою змінної середовища \s-1LANG.\s0 Значення
змінної \s-1LANG\s0 складається з декількох частин. Перша частина записується
малими літерами і визначає код мови. Друга частина є необов’язковою,
визначає код країни і записується прописними літерами, відокремлюється від
першої частини символом підкреслювання. Передбачено також необов’язкову
третю частину: кодування. Ця частина відокремлюється від другої частини
крапкою. Ось декілька прикладів для командних оболонок стандартного типу
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=uk українська
\& export LANG=uk_UA українська, Україна
\& export LANG=ru_UA російська, Україна
\& export LANG=es_ES іспанська, Іспанія
\& export LANG=es_MX іспанська, Мексика
\& export LANG=en_US.iso88591 англійська, США, кодування Latin\-1
\& export LANG=en_GB.UTF\-8 англійська, Великобританія, кодування UTF\-8
.Ve
.Sp
Повний список мов та кодів країн наведено у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
У системах Unix для отримання даних щодо локалі можна скористатися командою
\&\fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
За допомогою змінної середовища \s-1LANGUAGE\s0 ви можете вказати список
пріоритеності мов. Записи у списку слід відокремлювати двокрапками. Програма
dos2unix надає перевагу \s-1LANGUAGE\s0 над \s-1LANG.\s0 Наприклад, перша голландська,
далі німецька: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Спочатку вам слід увімкнути локалізацію,
встановивши для змінної \s-1LANG \s0(або \s-1LC_ALL\s0) значення, відмінне від «C». Далі
ви зможете використовувати список пріоритетності мов за допомогою змінної
\&\s-1LANGUAGE.\s0 Додаткові відомості можна знайти у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Якщо вами буде вибрано мову, перекладу якою немає, буде показано стандартні
повідомлення англійською мовою.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Змінну \s-1LOCALEDIR,\s0 встановлену під час збирання програми, можна змінити за
допомогою змінної середовища \s-1DOS2UNIX_LOCALEDIR. LOCALEDIR\s0 використовується
для пошуку файлів перекладів. Типовим значенням у системах \s-1GNU\s0 є
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Переглянути поточне значення змінної \s-1LOCALEDIR\s0
можна переглянути за допомогою параметра \fB\-\-version\fR.
.Sp
Приклад (командна оболонка \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "ПОВЕРНУТЕ ЗНАЧЕННЯ"
.IX Header "ПОВЕРНУТЕ ЗНАЧЕННЯ"
Якщо завдання вдасться успішно виконати, програма поверне нульовий код
виходу. Якщо станеться системна помилка, буде повернуто код цієї
помилки. Якщо станеться якась інша помилка, буде повернуто код 1.
.PP
У режимі без повідомлень повернутим значенням завжди буде нуль, якщо вказано
правильні параметри командного рядка.
.SH "СТАНДАРТИ"
.IX Header "СТАНДАРТИ"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://uk.wikipedia.org/wiki/Carriage_return>
.PP
<http://uk.wikipedia.org/wiki/Newline>
.PP
<http://uk.wikipedia.org/wiki/Unicode>
.SH "АВТОРИ"
.IX Header "АВТОРИ"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (режим
mac2unix) \- <wuebben@kde.org>, Christian Wurll (додатковий новий рядок) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (супровідник)
.PP
Сторінка проекту: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Сторінка на SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
.IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,796 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "НАЗВА"
.IX Header "НАЗВА"
dos2unix \- програма для перетворення даних у текстовому форматі DOS/Mac у
формат Unix, і навпаки
.SH "КОРОТКИЙ ОПИС"
.IX Header "КОРОТКИЙ ОПИС"
.Vb 2
\& dos2unix [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
\& unix2dos [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
.Ve
.SH "ОПИС"
.IX Header "ОПИС"
До складу пакунка Dos2unix включено програми \f(CW\*(C`dos2unix\*(C'\fR та \f(CW\*(C`unix2dos\*(C'\fR,
призначені для перетворення звичайних текстових даних у форматі \s-1DOS\s0 або Mac
на дані у форматі Unix, і навпаки.
.PP
У текстових файлах DOS/Windows розрив рядка або перехід на новий рядок
здійснюється за допомогою комбінації двох символів: повернення каретки (\s-1CR\s0)
і переведення рядка (\s-1LF\s0). У текстових файлах Unix за перехід на новий рядок
відповідає один символ: переведення рядка (\s-1LF\s0). У текстових файлах Mac, до
Mac \s-1OS X,\s0 за розрив рядка відповідав один символ: повернення каретки (\s-1CR\s0). У
сучасних версіях Mac \s-1OS\s0 використовується типовий для Unix розрив рядка (\s-1LF\s0).
.PP
Окрім символів розриву рядка, програма Dos2unix здатна виконувати
перетворення кодування файлів. Можна перетворити дані у декількох кодуваннях
\&\s-1DOS\s0 на файли у кодуванні Latin\-1 Unix. Також можна перетворити дані у файлах
Windows Unicode (\s-1UTF\-16\s0) на дані у кодуванні Unix Unicode (\s-1UTF\-8\s0).
.PP
Під час перетворення програма пропускатиме двійкові файли, якщо ви не
накажете їй виконати перетворення таких файлів безпосередньо.
.PP
Програма автоматично пропускатиме файли, які не є звичайними файлами,
зокрема каталоги та канали \s-1FIFO.\s0
.PP
Типово, програма не вноситиме змін до символічних посилань та об’єктів
посилань. Якщо потрібно, програма може замінити символічні посилання або
записати перетворені дані до файла\-призначення символічного посилання. У
Windows запису до об’єкта символічного посилання не передбачено.
.PP
Програму dos2unix було створено за зразком програми dos2unix для
SunOS/Solaris. Втім, існує одна важлива відмінність від оригінальної версії
для SunOS/Solaris. Ця версія типово виконує заміну файлів під час
перетворення (старий режим обробки файлів), а у оригінальній версії для
SunOS/Solaris передбачено підтримку лише парного перетворення (новий режим
обробки файлів). Див. також параметри \f(CW\*(C`\-o\*(C'\fR та \f(CW\*(C`\-n\*(C'\fR.
.SH "ПАРАМЕТРИ"
.IX Header "ПАРАМЕТРИ"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Вважати усі наступні параметри назвами файлів. Цим параметром слід
користуватися, якщо вам потрібно виконати перетворення файлів, чиї назви
містять дефіси. Наприклад, щоб виконати перетворення файла «\-foo»,
скористайтеся такою командою:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Або у новому режимі файлів:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Виконати лише перетворення символів розриву рядків. Типовий режим
перетворення.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Виконати перетворення з кодування \s-1DOS\s0 на кодування \s-1ISO\-8859\-1.\s0 Див. розділ
щодо режимів перетворення.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Використати кодову таблицю 1252 Windows (західноєвропейські мови).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Використовувати кодову сторінку \s-1DOS 437 \s0(США). Це типова кодова сторінка для
перетворення \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Використовувати кодову сторінку \s-1DOS 850 \s0(західноєвропейські мови).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Використовувати сторінку \s-1DOS 860 \s0(португальська).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Використовувати сторінку \s-1DOS 863 \s0(канадська французька).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Використовувати сторінку \s-1DOS 865 \s0(скандинавські мови).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Перетворювати 8\-бітові символи на 7\-бітові.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Зберегти позначку порядку байтів (\s-1BOM\s0). Якщо у файлі вхідних даних є \s-1BOM,\s0
записати \s-1BOM\s0 до файла результатів. Це типова поведінка під час перетворення
у формат із символами розриву рядків \s-1DOS.\s0 Див. також параметр \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode РЕЖИМ\fR" 4
.IX Item "-c, --convmode РЕЖИМ"
Встановити режим перетворення. Значенням аргументу РЕЖИМ може бути один з
таких рядків: \fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR. Типовим є режим ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Примусове перетворення двійкових файлів.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
У Windows файли в \s-1UTF\-16\s0 типово перетворюються на файли в \s-1UTF\-8,\s0 незалежно
від встановленої локалі. За допомогою цього параметра ви можете наказати
програмі перетворювати файли в \s-1UTF\-16\s0 на файли у \s-1GB18030.\s0 Цим параметром
можна скористатися лише у Windows. Див. також розділ, присвячений \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Показати довідкові дані і завершити роботу.
.IP "\fB\-i[ПРАПОРЦІ], \-\-info[=ПРАПОРЦІ] ФАЙЛ ...\fR" 4
.IX Item "-i[ПРАПОРЦІ], --info[=ПРАПОРЦІ] ФАЙЛ ..."
Вивести дані щодо файла. Не виконувати перетворення.
.Sp
Буде виведено такі дані, у вказаному порядку: кількість розривів рядків у
форматі \s-1DOS,\s0 кількість розривів рядків у форматі Unix, кількість розривів
рядків у форматі Mac, позначка порядку байтів, текстовим чи бінарним є файл
та назву файла.
.Sp
Приклад результатів:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Крім того, можна вказати додаткові прапорці для внесення змін у виведені
дані. Можна використовувати один або декілька таких прапорців.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Вивести кількість символів розривів рядка \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Вивести кількість символів розривів рядка Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Вивести кількість символів розривів рядка Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Вивести позначку порядку байтів.
.IP "\fBt\fR" 4
.IX Item "t"
Вивести дані щодо того, є файл текстовим чи бінарним.
.IP "\fBc\fR" 4
.IX Item "c"
Вивести дані лише тих файлів, які було б перетворено.
.Sp
Із прапорцем \f(CW\*(C`c\*(C'\fR dos2unix виведе лише назви файлів, у яких містяться
розриви рядків \s-1DOS.\s0 unix2dos виведе лише назви файлів, у яких містяться
розриви рядків Unix.
.RE
.RS 4
.Sp
Приклади:
.Sp
Вивести дані щодо усіх файлів *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Вивести кількість розривів рядків у форматі \s-1DOS\s0 і розривів рядків у форматі
Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Вивести лише позначку порядку байтів:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Вивести список файлів, у яких є символи розриву рядків \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Вивести список файлів, у яких використано символи розриву рядків Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Зберегти часову позначку файла вхідних даних у файлі результатів
перетворення.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Вивести умови ліцензування програми.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Вставити додатковий символ розриву рядка.
.Sp
\&\fBdos2unix\fR: перетворення на два символи розриву рядків Unix відбуватиметься
лише для комбінацій розриву рядків \s-1DOS.\s0 У режимі Mac виконуватиметься
перетворення на два розриви рядків Unix лише символів розриву рядків Mac.
.Sp
\&\fBunix2dos\fR: перетворення на дві комбінації розриву рядків \s-1DOS\s0
відбуватиметься лише для символів розриву рядків \s-1DOS.\s0 У режимі Mac
виконуватиметься перетворення на два розриви рядків Mac лише символів
розриву рядків Unix.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Записати до файла результатів позначку порядку байтів (\s-1BOM\s0). Типово буде
записано позначку порядку байтів \s-1UTF\-8.\s0
.Sp
Якщо дані початкового файла закодовано у \s-1UTF\-16\s0 і використано параметр
\&\f(CW\*(C`\-u\*(C'\fR, буде дописано позначку порядку байтів \s-1UTF\-16.\s0
.Sp
Не використовуйте цей параметр для кодувань результатів, відмінних від \s-1UTF\-8\s0
або \s-1UTF\-16.\s0 Див. також розділ щодо \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...\fR" 4
.IX Item "-n, --newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ..."
Новий режим обробки файлів. Перетворити дані з файла ВХІДНИЙ_ФАЙЛ і записати
результати до файла ВИХІДНИЙ_ФАЙЛ. Назви файлів слід вказувати парами, \fIне
слід\fR використовувати шаблони заміни, інакше вміст файлів \fIбуде втрачено\fR.
.Sp
Власником перетвореного файла буде призначено користувача, яким було
розпочато перетворення у режимі нового файла (парному режимі). Права доступу
на читання або запис нового файла буде визначено на основі прав доступу до
початкового файла мінус \fIumask\fR\|(1) для користувача, яким було розпочато
перетворення.
.IP "\fB\-o, \-\-oldfile ФАЙЛ ...\fR" 4
.IX Item "-o, --oldfile ФАЙЛ ..."
Застарілий режим обробки. Виконати перетворення файла ФАЙЛ і перезаписати
його вміст. Типово, програма працює у цьому режимі. Можна використовувати
шаблони заміни.
.Sp
У застарілому режимі (режимі заміщення) перетворений файл належатиме тому
самому власнику і групі і матиме ті самі права доступу на читання або запис,
що і початковий файл. Крім того, якщо перетворення файла виконується іншим
користувачем, який має права доступу на запис до файла (наприклад
користувачем root), перетворення буде перервано, якщо зберегти початкові
значення не вдасться. Зміна власника може означати неможливість читання
файла для його початкового власника. Зміна групи може призвести до проблем
із безпекою, оскільки файл може стати доступним для читання користувачам,
які не повинні мати такі права доступу. Можливість збереження прав власності
та прав доступу до файла передбачено лише у Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Режим без виведення повідомлень. Програма не виводитиме жодних попереджень
або повідомлень про помилки. Повернутим значенням завжди буде нуль, якщо
вказано правильні параметри командного рядка.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Вилучити позначку порядку байтів (\s-1BOM\s0). Не записувати \s-1BOM\s0 до файла
результатів. Це типова поведінка під час перетворення файлів з форматом
розриву рядків Unix. Див. також параметр \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Пропускати двійкові файли (типово).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Зберегти початкове кодування \s-1UTF\-16.\s0 Файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 із прямим або зворотним порядком байтів, що і
початковий файл. Таким чином можна запобігти перетворенню даних у кодування
\&\s-1UTF\-8.\s0 До файла буде записано відповідну позначку порядку байтів
\&\s-1UTF\-16.\s0 Вимкнути цей параметр можна за допомогою параметра \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Припускати, що кодуванням вхідних файлів є \s-1UTF\-16LE.\s0
.Sp
Якщо у початковому файлі є позначка порядку байтів (\s-1BOM\s0), її буде
використано у файлі\-результаті, незалежно від використання цього параметра.
.Sp
Якщо вами було зроблено помилкове припущення щодо формату файла (файл
вхідних даних насправді не є файлом у форматі \s-1UTF\-16LE\s0), і дані вдасться
успішно перетворити, ви отримаєте файл у кодуванні \s-1UTF\-8\s0 з помилковим
вмістом. Скасувати таке помилкове перетворення можна за допомогою зворотного
перетворення \fIiconv\fR\|(1) з даних у форматі \s-1UTF\-8\s0 на дані у форматі
\&\s-1UTF\-16LE.\s0 Таким чином ви повернетеся до початкового кодування даних у файлі.
.Sp
Припущення щодо форматування \s-1UTF\-16LE\s0 працює як визначення \fIрежиму
перетворення\fR. Перемиканням на типовий режим \fIascii\fR можна вимкнути
припущення щодо форматування \s-1UTF\-16LE.\s0
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Припускати, що вхідним форматом є \s-1UTF\-16BE.\s0
.Sp
Цей параметр працює у спосіб, тотожний до параметра \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Виводити докладні повідомлення. Буде показано додаткові дані щодо позначок
порядку байтів та кількості перетворених символів розриву рядків.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Переходити за символічними посиланням і перетворювати файли, на які вони
вказують.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Замінити символічні посилання перетвореними файлами (початкові файли, на які
вони вказують, змінено не буде).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Не змінювати символічні посилання та файли, на які вони посилаються
(типово).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Вивести дані щодо версії і завершити роботу.
.SH "РЕЖИМ MAC"
.IX Header "РЕЖИМ MAC"
У звичайному режимі розриви рядків \s-1DOS\s0 перетворюються на розриви рядків
Unix, і навпаки. Розриви рядків Mac перетворенню не підлягають.
.PP
У режимі Mac розриви рядків Mac перетворюються на розриви рядків Unix, і
навпаки. Розриви рядків \s-1DOS\s0 перетворенню не підлягають.
.PP
Щоб запустити програму у режимі перетворення Mac, скористайтеся параметром
командного рядка \f(CW\*(C`\-c mac\*(C'\fR або програмами \f(CW\*(C`mac2unix\*(C'\fR та \f(CW\*(C`unix2mac\*(C'\fR.
.SH "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IX Header "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IP "\fBascii\fR" 4
.IX Item "ascii"
У режимі \f(CW\*(C`ascii\*(C'\fR виконуватиметься лише перетворення символів розриву
рядків. Цей режим є типовим режимом перетворення.
.Sp
Хоча цей режим і називається режимом \s-1ASCII \s0(стандарту 7\-бітового кодування),
насправді кодування символів у ньому є 8\-бітовим. Завжди користуйтеся цим
режимом для перетворення файлів у кодуванні \s-1UTF\-8 \s0(Unicode).
.IP "\fB7bit\fR" 4
.IX Item "7bit"
У цьому режимі усі 8\-бітові символи, які не є частиною \s-1ASCII, \s0(з номерами
від 128 до 255) буде перетворено на відповідні 7\-бітові символи.
.IP "\fBiso\fR" 4
.IX Item "iso"
Перетворення символів буде виконано з кодування (кодової сторінки) \s-1DOS\s0 до
кодування \s-1ISO\-8859\-1 \s0(Latin\-1) у Unix. Символи \s-1DOS,\s0 які не мають
еквівалентів у \s-1ISO\-8859\-1\s0 і перетворення яких неможливе, буде перетворено на
символ крапки. Те саме стосується символів \s-1ISO\-8859\-1,\s0 які не мають
еквівалентів у \s-1DOS.\s0
.Sp
Якщо буде використано лише параметр \f(CW\*(C`\-iso\*(C'\fR, програма dos2unix спробує
визначити активне кодування. Якщо це виявиться неможливим, dos2unix
використає типове кодування \s-1CP437,\s0 яке здебільшого використовується у
США. Щоб примусово визначити кодування, скористайтеся параметром \f(CW\*(C`\-437\*(C'\fR
(США), \f(CW\*(C`\-850\*(C'\fR (західноєвропейські мови), \f(CW\*(C`\-860\*(C'\fR (португальська), \f(CW\*(C`\-863\*(C'\fR
(канадська французька) або \f(CW\*(C`\-865\*(C'\fR (скандинавські мови). Використати
кодування Windows \s-1CP1252 \s0(західноєвропейські мови) можна за допомогою
параметра \f(CW\*(C`\-1252\*(C'\fR. Для інших кодувань використовуйте поєднання dos2unix з
\&\fIiconv\fR\|(1). Програма iconv здатна виконувати перетворення даних у доволі
широкому спектрі кодувань символів.
.Sp
Ніколи не користуйтеся перетворенням \s-1ISO\s0 для текстових файлів у форматі
Unicode. Використання подібного перетворення призведе до ушкодження вмісту
файлів у кодуванні \s-1UTF\-8.\s0
.Sp
Декілька прикладів:
.Sp
Перетворити дані у типовому кодуванні \s-1DOS\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1DOS CP850\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP1252\s0 Windows на дані у кодуванні Latin\-1
Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP252\s0 Windows на дані у кодуванні \s-1UTF\-8\s0 Unix
(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у типовому кодуванні \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні Windows
\&\s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix (Unicode) на дані у кодуванні
Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Див. також <http://czyborra.com/charsets/codepages.html> та
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Кодування"
.IX Subsection "Кодування"
Існує декілька різних кодувань Unicode. У Unix та Linux у файлах Unicode
здебільшого використовується кодування \s-1UTF\-8.\s0 У Windows для текстових файлів
Unicode може бути використано кодування \s-1UTF\-8, UTF\-16\s0 або \s-1UTF\-16\s0 зі
зворотним порядком байтів. Втім, здебільшого, використовується формат
\&\s-1UTF\-16.\s0
.SS "Перетворення"
.IX Subsection "Перетворення"
У текстових файлах Unicode, як і у звичайних текстових файлах, може бути
використано розриви рядків \s-1DOS,\s0 Unix або Mac.
.PP
Усі версії dos2unix та unix2dos здатні виконувати перетворення у кодуванні
\&\s-1UTF\-8,\s0 оскільки \s-1UTF\-8\s0 було розроблено так, що зворотну сумісність з \s-1ASCII\s0
збережено.
.PP
Програми dos2unix та unix2dos, зібрані з підтримкою Unicode \s-1UTF\-16,\s0 можуть
читати текстові файли у кодуванні \s-1UTF\-16\s0 з прямим та зворотним порядком
байтів. Щоб дізнатися про те, чи було dos2unix зібрано з підтримкою \s-1UTF\-16,\s0
віддайте команду \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
У Unix/Linux файли у кодуванні \s-1UTF\-16\s0 перетворюються на файли у кодуванні
локалі. Для визначення поточного кодування символів локалі скористайтеся
командою \fIlocale\fR\|(1). Якщо перетворення виявиться неможливим, програма
повідомить про помилку перетворення і пропустить відповідний файл.
.PP
У Windows файли \s-1UTF\-16\s0 типово буде перетворено на файли \s-1UTF\-8.\s0 Обидва типи
систем, Windows та Unix/Linux, мають непогані можливості з підтримки файлів
у форматуванні \s-1UTF\-8.\s0
.PP
Кодування \s-1UTF\-16\s0 та \s-1UTF\-8\s0 є повністю сумісними. Під час перетворення не буде
втрачено жодної інформації. Якщо під час перетворення даних у кодуванні
\&\s-1UTF\-16\s0 на дані у кодуванні \s-1UTF\-8\s0 трапиться помилка, наприклад, якщо у
вхідному файлі \s-1UTF\-16\s0 міститиметься якась помилка, файл буде пропущено.
.PP
Якщо використано параметр \f(CW\*(C`\-u\*(C'\fR, файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 що і початковий файл. Використання параметра Option
\&\f(CW\*(C`\-u\*(C'\fR запобігає перетворенню даних у кодування \s-1UTF\-8.\s0
.PP
У dos2unix та unix2dos не передбачено параметра для перетворення даних у
кодуванні \s-1UTF\-8\s0 на дані у кодуванні \s-1UTF\-16.\s0
.PP
Режим перетворення \s-1ISO\s0 та 7\-бітовий режим не працюють для файлів \s-1UTF\-16.\s0
.SS "Позначка порядку байтів"
.IX Subsection "Позначка порядку байтів"
У Windows до текстових файлів у кодуванні Unicode типово дописується
позначка порядку байтів (\s-1BOM\s0), оскільки багато програм Windows (зокрема
Notepad) додають таку позначку автоматично. Див. також
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
У Unix файли у кодуванні Unicode типово не містять позначки порядку
байтів. Вважається, що кодуванням текстових файлів є те кодування, яке
визначається поточною локаллю.
.PP
Програма dos2unix може визначити, чи є кодуванням файла \s-1UTF\-16,\s0 лише якщо у
файлі міститься позначка порядку байтів. Якщо у файлі, де використано
кодування \s-1UTF\-16,\s0 немає такої позначки, dos2unix вважатиме такий файл
двійковим (бінарним).
.PP
Для перетворення файлів \s-1UTF\-16\s0 без позначки порядку байтів скористайтеся
параметром \f(CW\*(C`\-ul\*(C'\fR або \f(CW\*(C`\-ub\*(C'\fR.
.PP
Типово dos2unix не записує до файлів результатів перетворення позначки
порядку байтів (\s-1BOM\s0). Якщо використано параметр \f(CW\*(C`\-b\*(C'\fR, dos2unix запише до
файла результатів \s-1BOM,\s0 якщо \s-1BOM\s0 була у файлі початкових даних.
.PP
Типово unix2dos записує позначку порядку байтів (\s-1BOM\s0) до файла результатів,
якщо \s-1BOM\s0 є у початковому файлі. Скористайтеся параметром \f(CW\*(C`\-r\*(C'\fR, щоб вилучити
\&\s-1BOM.\s0
.PP
Dos2unix та unix2dos завжди записують до файла результатів позначку порядку
байтів (\s-1BOM\s0), якщо використано параметр \f(CW\*(C`\-m\*(C'\fR.
.SS "Приклади для Unicode"
.IX Subsection "Приклади для Unicode"
Перетворити дані з Windows \s-1UTF\-16 \s0(з позначкою порядку байтів (\s-1BOM\s0)) у
формат Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Перетворити дані у форматі Windows \s-1UTF\-16LE \s0(без \s-1BOM\s0) на дані у форматі
\&\s-1UTF\-8\s0 Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-8\s0
без \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 є китайським урядовим стандартом. Підтримка обов’язкової підмножини
стандарту \s-1GB18030\s0 є неодмінною вимогою до будь\-яких програмних продуктів,
які продаються у Китаї. Див. також <http://en.wikipedia.org/wiki/GB_18030>.
.PP
Кодування \s-1GB18030\s0 є повністю сумісним із Unicode. Його можна розглядати як
формат перетворення unicode. Подібно до \s-1UTF\-8, GB18030\s0 є сумісним із
\&\s-1ASCII. GB18030\s0 також є сумісним із кодовою сторінкою Windows 936, яку ще
називають \s-1GBK.\s0
.PP
У Unix/Linux файли \s-1UTF\-16\s0 буде перетворено до кодування \s-1GB18030,\s0 якщо
кодуванням локалі є \s-1GB18030.\s0 Зауважте, що це спрацює, лише якщо встановлено
значення країни КНР. Наприклад, у англійській локалі для Великоританії із
встановленою локаллю \f(CW\*(C`en_GB.GB18030\*(C'\fR перетворення \s-1UTF\-16\s0 на \s-1GB18030\s0 не
працюватиме, а у китайській локалі \f(CW\*(C`zh_CN.GB18030\*(C'\fR все працюватиме як слід.
.PP
У Windows для перетворення файлів \s-1UTF\-16\s0 на файли \s-1GB18030\s0 слід вказати
параметр \f(CW\*(C`\-gb\*(C'\fR.
.PP
У файлах у кодуванні \s-1GB18030\s0 може міститися позначка порядку байтів, так
само, як у файлах у кодуванні Unicode.
.SH "ПРИКЛАДИ"
.IX Header "ПРИКЛАДИ"
Прочитати вхідні дані зі стандартного джерела (stdin) і записати результат
до стандартного виведення (stdout):
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
замістити цей файл:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення
ascii. Перетворити дані у b.txt і замістити цей файл у режимі 7\-бітового
перетворення:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Перетворити файл a.txt з формату Mac на формат Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Перетворити файл a.txt з формату Unix на формат Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Перетворити дані у a.txt, замістити цей файл і зберегти часову позначку
початкового файла:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла
e.txt. Скопіювати часову позначку файла a.txt для файла e.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
записати результат до e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Перетворити дані у c.txt і записати результати до e.txt. Перетворити дані у
a.txt і замістити ними цей файл. Перетворити дані у b.txt і замістити ними
цей файл. Перетворити дані у d.txt і записати результати до f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
.IX Header "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
Для рекурсивного перетворення текстових файлів у ієрархії каталогів слід
використовувати dos2unix у поєднанні з програмами \fIfind\fR\|(1) та
\&\fIxargs\fR\|(1). Наприклад, щоб виконати перетворення усіх файлів .txt у структурі
підкаталогів поточного каталогу, віддайте таку команду:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "ЛОКАЛІЗАЦІЯ"
.IX Header "ЛОКАЛІЗАЦІЯ"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Основна мова визначається за допомогою змінної середовища \s-1LANG.\s0 Значення
змінної \s-1LANG\s0 складається з декількох частин. Перша частина записується
малими літерами і визначає код мови. Друга частина є необов’язковою,
визначає код країни і записується прописними літерами, відокремлюється від
першої частини символом підкреслювання. Передбачено також необов’язкову
третю частину: кодування. Ця частина відокремлюється від другої частини
крапкою. Ось декілька прикладів для командних оболонок стандартного типу
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=uk українська
\& export LANG=uk_UA українська, Україна
\& export LANG=ru_UA російська, Україна
\& export LANG=es_ES іспанська, Іспанія
\& export LANG=es_MX іспанська, Мексика
\& export LANG=en_US.iso88591 англійська, США, кодування Latin\-1
\& export LANG=en_GB.UTF\-8 англійська, Великобританія, кодування UTF\-8
.Ve
.Sp
Повний список мов та кодів країн наведено у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
У системах Unix для отримання даних щодо локалі можна скористатися командою
\&\fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
За допомогою змінної середовища \s-1LANGUAGE\s0 ви можете вказати список
пріоритеності мов. Записи у списку слід відокремлювати двокрапками. Програма
dos2unix надає перевагу \s-1LANGUAGE\s0 над \s-1LANG.\s0 Наприклад, перша голландська,
далі німецька: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Спочатку вам слід увімкнути локалізацію,
встановивши для змінної \s-1LANG \s0(або \s-1LC_ALL\s0) значення, відмінне від «C». Далі
ви зможете використовувати список пріоритетності мов за допомогою змінної
\&\s-1LANGUAGE.\s0 Додаткові відомості можна знайти у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Якщо вами буде вибрано мову, перекладу якою немає, буде показано стандартні
повідомлення англійською мовою.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Змінну \s-1LOCALEDIR,\s0 встановлену під час збирання програми, можна змінити за
допомогою змінної середовища \s-1DOS2UNIX_LOCALEDIR. LOCALEDIR\s0 використовується
для пошуку файлів перекладів. Типовим значенням у системах \s-1GNU\s0 є
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Переглянути поточне значення змінної \s-1LOCALEDIR\s0
можна переглянути за допомогою параметра \fB\-\-version\fR.
.Sp
Приклад (командна оболонка \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "ПОВЕРНУТЕ ЗНАЧЕННЯ"
.IX Header "ПОВЕРНУТЕ ЗНАЧЕННЯ"
Якщо завдання вдасться успішно виконати, програма поверне нульовий код
виходу. Якщо станеться системна помилка, буде повернуто код цієї
помилки. Якщо станеться якась інша помилка, буде повернуто код 1.
.PP
У режимі без повідомлень повернутим значенням завжди буде нуль, якщо вказано
правильні параметри командного рядка.
.SH "СТАНДАРТИ"
.IX Header "СТАНДАРТИ"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://uk.wikipedia.org/wiki/Carriage_return>
.PP
<http://uk.wikipedia.org/wiki/Newline>
.PP
<http://uk.wikipedia.org/wiki/Unicode>
.SH "АВТОРИ"
.IX Header "АВТОРИ"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (режим
mac2unix) \- <wuebben@kde.org>, Christian Wurll (додатковий новий рядок) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (супровідник)
.PP
Сторінка проекту: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Сторінка на SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
.IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,796 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "НАЗВА"
.IX Header "НАЗВА"
dos2unix \- програма для перетворення даних у текстовому форматі DOS/Mac у
формат Unix, і навпаки
.SH "КОРОТКИЙ ОПИС"
.IX Header "КОРОТКИЙ ОПИС"
.Vb 2
\& dos2unix [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
\& unix2dos [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
.Ve
.SH "ОПИС"
.IX Header "ОПИС"
До складу пакунка Dos2unix включено програми \f(CW\*(C`dos2unix\*(C'\fR та \f(CW\*(C`unix2dos\*(C'\fR,
призначені для перетворення звичайних текстових даних у форматі \s-1DOS\s0 або Mac
на дані у форматі Unix, і навпаки.
.PP
У текстових файлах DOS/Windows розрив рядка або перехід на новий рядок
здійснюється за допомогою комбінації двох символів: повернення каретки (\s-1CR\s0)
і переведення рядка (\s-1LF\s0). У текстових файлах Unix за перехід на новий рядок
відповідає один символ: переведення рядка (\s-1LF\s0). У текстових файлах Mac, до
Mac \s-1OS X,\s0 за розрив рядка відповідав один символ: повернення каретки (\s-1CR\s0). У
сучасних версіях Mac \s-1OS\s0 використовується типовий для Unix розрив рядка (\s-1LF\s0).
.PP
Окрім символів розриву рядка, програма Dos2unix здатна виконувати
перетворення кодування файлів. Можна перетворити дані у декількох кодуваннях
\&\s-1DOS\s0 на файли у кодуванні Latin\-1 Unix. Також можна перетворити дані у файлах
Windows Unicode (\s-1UTF\-16\s0) на дані у кодуванні Unix Unicode (\s-1UTF\-8\s0).
.PP
Під час перетворення програма пропускатиме двійкові файли, якщо ви не
накажете їй виконати перетворення таких файлів безпосередньо.
.PP
Програма автоматично пропускатиме файли, які не є звичайними файлами,
зокрема каталоги та канали \s-1FIFO.\s0
.PP
Типово, програма не вноситиме змін до символічних посилань та об’єктів
посилань. Якщо потрібно, програма може замінити символічні посилання або
записати перетворені дані до файла\-призначення символічного посилання. У
Windows запису до об’єкта символічного посилання не передбачено.
.PP
Програму dos2unix було створено за зразком програми dos2unix для
SunOS/Solaris. Втім, існує одна важлива відмінність від оригінальної версії
для SunOS/Solaris. Ця версія типово виконує заміну файлів під час
перетворення (старий режим обробки файлів), а у оригінальній версії для
SunOS/Solaris передбачено підтримку лише парного перетворення (новий режим
обробки файлів). Див. також параметри \f(CW\*(C`\-o\*(C'\fR та \f(CW\*(C`\-n\*(C'\fR.
.SH "ПАРАМЕТРИ"
.IX Header "ПАРАМЕТРИ"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Вважати усі наступні параметри назвами файлів. Цим параметром слід
користуватися, якщо вам потрібно виконати перетворення файлів, чиї назви
містять дефіси. Наприклад, щоб виконати перетворення файла «\-foo»,
скористайтеся такою командою:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Або у новому режимі файлів:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Виконати лише перетворення символів розриву рядків. Типовий режим
перетворення.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Виконати перетворення з кодування \s-1DOS\s0 на кодування \s-1ISO\-8859\-1.\s0 Див. розділ
щодо режимів перетворення.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Використати кодову таблицю 1252 Windows (західноєвропейські мови).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Використовувати кодову сторінку \s-1DOS 437 \s0(США). Це типова кодова сторінка для
перетворення \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Використовувати кодову сторінку \s-1DOS 850 \s0(західноєвропейські мови).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Використовувати сторінку \s-1DOS 860 \s0(португальська).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Використовувати сторінку \s-1DOS 863 \s0(канадська французька).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Використовувати сторінку \s-1DOS 865 \s0(скандинавські мови).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Перетворювати 8\-бітові символи на 7\-бітові.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Зберегти позначку порядку байтів (\s-1BOM\s0). Якщо у файлі вхідних даних є \s-1BOM,\s0
записати \s-1BOM\s0 до файла результатів. Це типова поведінка під час перетворення
у формат із символами розриву рядків \s-1DOS.\s0 Див. також параметр \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode РЕЖИМ\fR" 4
.IX Item "-c, --convmode РЕЖИМ"
Встановити режим перетворення. Значенням аргументу РЕЖИМ може бути один з
таких рядків: \fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR. Типовим є режим ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Примусове перетворення двійкових файлів.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
У Windows файли в \s-1UTF\-16\s0 типово перетворюються на файли в \s-1UTF\-8,\s0 незалежно
від встановленої локалі. За допомогою цього параметра ви можете наказати
програмі перетворювати файли в \s-1UTF\-16\s0 на файли у \s-1GB18030.\s0 Цим параметром
можна скористатися лише у Windows. Див. також розділ, присвячений \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Показати довідкові дані і завершити роботу.
.IP "\fB\-i[ПРАПОРЦІ], \-\-info[=ПРАПОРЦІ] ФАЙЛ ...\fR" 4
.IX Item "-i[ПРАПОРЦІ], --info[=ПРАПОРЦІ] ФАЙЛ ..."
Вивести дані щодо файла. Не виконувати перетворення.
.Sp
Буде виведено такі дані, у вказаному порядку: кількість розривів рядків у
форматі \s-1DOS,\s0 кількість розривів рядків у форматі Unix, кількість розривів
рядків у форматі Mac, позначка порядку байтів, текстовим чи бінарним є файл
та назву файла.
.Sp
Приклад результатів:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Крім того, можна вказати додаткові прапорці для внесення змін у виведені
дані. Можна використовувати один або декілька таких прапорців.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Вивести кількість символів розривів рядка \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Вивести кількість символів розривів рядка Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Вивести кількість символів розривів рядка Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Вивести позначку порядку байтів.
.IP "\fBt\fR" 4
.IX Item "t"
Вивести дані щодо того, є файл текстовим чи бінарним.
.IP "\fBc\fR" 4
.IX Item "c"
Вивести дані лише тих файлів, які було б перетворено.
.Sp
Із прапорцем \f(CW\*(C`c\*(C'\fR dos2unix виведе лише назви файлів, у яких містяться
розриви рядків \s-1DOS.\s0 unix2dos виведе лише назви файлів, у яких містяться
розриви рядків Unix.
.RE
.RS 4
.Sp
Приклади:
.Sp
Вивести дані щодо усіх файлів *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Вивести кількість розривів рядків у форматі \s-1DOS\s0 і розривів рядків у форматі
Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Вивести лише позначку порядку байтів:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Вивести список файлів, у яких є символи розриву рядків \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Вивести список файлів, у яких використано символи розриву рядків Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Зберегти часову позначку файла вхідних даних у файлі результатів
перетворення.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Вивести умови ліцензування програми.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Вставити додатковий символ розриву рядка.
.Sp
\&\fBdos2unix\fR: перетворення на два символи розриву рядків Unix відбуватиметься
лише для комбінацій розриву рядків \s-1DOS.\s0 У режимі Mac виконуватиметься
перетворення на два розриви рядків Unix лише символів розриву рядків Mac.
.Sp
\&\fBunix2dos\fR: перетворення на дві комбінації розриву рядків \s-1DOS\s0
відбуватиметься лише для символів розриву рядків \s-1DOS.\s0 У режимі Mac
виконуватиметься перетворення на два розриви рядків Mac лише символів
розриву рядків Unix.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Записати до файла результатів позначку порядку байтів (\s-1BOM\s0). Типово буде
записано позначку порядку байтів \s-1UTF\-8.\s0
.Sp
Якщо дані початкового файла закодовано у \s-1UTF\-16\s0 і використано параметр
\&\f(CW\*(C`\-u\*(C'\fR, буде дописано позначку порядку байтів \s-1UTF\-16.\s0
.Sp
Не використовуйте цей параметр для кодувань результатів, відмінних від \s-1UTF\-8\s0
або \s-1UTF\-16.\s0 Див. також розділ щодо \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...\fR" 4
.IX Item "-n, --newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ..."
Новий режим обробки файлів. Перетворити дані з файла ВХІДНИЙ_ФАЙЛ і записати
результати до файла ВИХІДНИЙ_ФАЙЛ. Назви файлів слід вказувати парами, \fIне
слід\fR використовувати шаблони заміни, інакше вміст файлів \fIбуде втрачено\fR.
.Sp
Власником перетвореного файла буде призначено користувача, яким було
розпочато перетворення у режимі нового файла (парному режимі). Права доступу
на читання або запис нового файла буде визначено на основі прав доступу до
початкового файла мінус \fIumask\fR\|(1) для користувача, яким було розпочато
перетворення.
.IP "\fB\-o, \-\-oldfile ФАЙЛ ...\fR" 4
.IX Item "-o, --oldfile ФАЙЛ ..."
Застарілий режим обробки. Виконати перетворення файла ФАЙЛ і перезаписати
його вміст. Типово, програма працює у цьому режимі. Можна використовувати
шаблони заміни.
.Sp
У застарілому режимі (режимі заміщення) перетворений файл належатиме тому
самому власнику і групі і матиме ті самі права доступу на читання або запис,
що і початковий файл. Крім того, якщо перетворення файла виконується іншим
користувачем, який має права доступу на запис до файла (наприклад
користувачем root), перетворення буде перервано, якщо зберегти початкові
значення не вдасться. Зміна власника може означати неможливість читання
файла для його початкового власника. Зміна групи може призвести до проблем
із безпекою, оскільки файл може стати доступним для читання користувачам,
які не повинні мати такі права доступу. Можливість збереження прав власності
та прав доступу до файла передбачено лише у Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Режим без виведення повідомлень. Програма не виводитиме жодних попереджень
або повідомлень про помилки. Повернутим значенням завжди буде нуль, якщо
вказано правильні параметри командного рядка.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Вилучити позначку порядку байтів (\s-1BOM\s0). Не записувати \s-1BOM\s0 до файла
результатів. Це типова поведінка під час перетворення файлів з форматом
розриву рядків Unix. Див. також параметр \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Пропускати двійкові файли (типово).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Зберегти початкове кодування \s-1UTF\-16.\s0 Файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 із прямим або зворотним порядком байтів, що і
початковий файл. Таким чином можна запобігти перетворенню даних у кодування
\&\s-1UTF\-8.\s0 До файла буде записано відповідну позначку порядку байтів
\&\s-1UTF\-16.\s0 Вимкнути цей параметр можна за допомогою параметра \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Припускати, що кодуванням вхідних файлів є \s-1UTF\-16LE.\s0
.Sp
Якщо у початковому файлі є позначка порядку байтів (\s-1BOM\s0), її буде
використано у файлі\-результаті, незалежно від використання цього параметра.
.Sp
Якщо вами було зроблено помилкове припущення щодо формату файла (файл
вхідних даних насправді не є файлом у форматі \s-1UTF\-16LE\s0), і дані вдасться
успішно перетворити, ви отримаєте файл у кодуванні \s-1UTF\-8\s0 з помилковим
вмістом. Скасувати таке помилкове перетворення можна за допомогою зворотного
перетворення \fIiconv\fR\|(1) з даних у форматі \s-1UTF\-8\s0 на дані у форматі
\&\s-1UTF\-16LE.\s0 Таким чином ви повернетеся до початкового кодування даних у файлі.
.Sp
Припущення щодо форматування \s-1UTF\-16LE\s0 працює як визначення \fIрежиму
перетворення\fR. Перемиканням на типовий режим \fIascii\fR можна вимкнути
припущення щодо форматування \s-1UTF\-16LE.\s0
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Припускати, що вхідним форматом є \s-1UTF\-16BE.\s0
.Sp
Цей параметр працює у спосіб, тотожний до параметра \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Виводити докладні повідомлення. Буде показано додаткові дані щодо позначок
порядку байтів та кількості перетворених символів розриву рядків.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Переходити за символічними посиланням і перетворювати файли, на які вони
вказують.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Замінити символічні посилання перетвореними файлами (початкові файли, на які
вони вказують, змінено не буде).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Не змінювати символічні посилання та файли, на які вони посилаються
(типово).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Вивести дані щодо версії і завершити роботу.
.SH "РЕЖИМ MAC"
.IX Header "РЕЖИМ MAC"
У звичайному режимі розриви рядків \s-1DOS\s0 перетворюються на розриви рядків
Unix, і навпаки. Розриви рядків Mac перетворенню не підлягають.
.PP
У режимі Mac розриви рядків Mac перетворюються на розриви рядків Unix, і
навпаки. Розриви рядків \s-1DOS\s0 перетворенню не підлягають.
.PP
Щоб запустити програму у режимі перетворення Mac, скористайтеся параметром
командного рядка \f(CW\*(C`\-c mac\*(C'\fR або програмами \f(CW\*(C`mac2unix\*(C'\fR та \f(CW\*(C`unix2mac\*(C'\fR.
.SH "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IX Header "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IP "\fBascii\fR" 4
.IX Item "ascii"
У режимі \f(CW\*(C`ascii\*(C'\fR виконуватиметься лише перетворення символів розриву
рядків. Цей режим є типовим режимом перетворення.
.Sp
Хоча цей режим і називається режимом \s-1ASCII \s0(стандарту 7\-бітового кодування),
насправді кодування символів у ньому є 8\-бітовим. Завжди користуйтеся цим
режимом для перетворення файлів у кодуванні \s-1UTF\-8 \s0(Unicode).
.IP "\fB7bit\fR" 4
.IX Item "7bit"
У цьому режимі усі 8\-бітові символи, які не є частиною \s-1ASCII, \s0(з номерами
від 128 до 255) буде перетворено на відповідні 7\-бітові символи.
.IP "\fBiso\fR" 4
.IX Item "iso"
Перетворення символів буде виконано з кодування (кодової сторінки) \s-1DOS\s0 до
кодування \s-1ISO\-8859\-1 \s0(Latin\-1) у Unix. Символи \s-1DOS,\s0 які не мають
еквівалентів у \s-1ISO\-8859\-1\s0 і перетворення яких неможливе, буде перетворено на
символ крапки. Те саме стосується символів \s-1ISO\-8859\-1,\s0 які не мають
еквівалентів у \s-1DOS.\s0
.Sp
Якщо буде використано лише параметр \f(CW\*(C`\-iso\*(C'\fR, програма dos2unix спробує
визначити активне кодування. Якщо це виявиться неможливим, dos2unix
використає типове кодування \s-1CP437,\s0 яке здебільшого використовується у
США. Щоб примусово визначити кодування, скористайтеся параметром \f(CW\*(C`\-437\*(C'\fR
(США), \f(CW\*(C`\-850\*(C'\fR (західноєвропейські мови), \f(CW\*(C`\-860\*(C'\fR (португальська), \f(CW\*(C`\-863\*(C'\fR
(канадська французька) або \f(CW\*(C`\-865\*(C'\fR (скандинавські мови). Використати
кодування Windows \s-1CP1252 \s0(західноєвропейські мови) можна за допомогою
параметра \f(CW\*(C`\-1252\*(C'\fR. Для інших кодувань використовуйте поєднання dos2unix з
\&\fIiconv\fR\|(1). Програма iconv здатна виконувати перетворення даних у доволі
широкому спектрі кодувань символів.
.Sp
Ніколи не користуйтеся перетворенням \s-1ISO\s0 для текстових файлів у форматі
Unicode. Використання подібного перетворення призведе до ушкодження вмісту
файлів у кодуванні \s-1UTF\-8.\s0
.Sp
Декілька прикладів:
.Sp
Перетворити дані у типовому кодуванні \s-1DOS\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1DOS CP850\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP1252\s0 Windows на дані у кодуванні Latin\-1
Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP252\s0 Windows на дані у кодуванні \s-1UTF\-8\s0 Unix
(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у типовому кодуванні \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні Windows
\&\s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix (Unicode) на дані у кодуванні
Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Див. також <http://czyborra.com/charsets/codepages.html> та
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Кодування"
.IX Subsection "Кодування"
Існує декілька різних кодувань Unicode. У Unix та Linux у файлах Unicode
здебільшого використовується кодування \s-1UTF\-8.\s0 У Windows для текстових файлів
Unicode може бути використано кодування \s-1UTF\-8, UTF\-16\s0 або \s-1UTF\-16\s0 зі
зворотним порядком байтів. Втім, здебільшого, використовується формат
\&\s-1UTF\-16.\s0
.SS "Перетворення"
.IX Subsection "Перетворення"
У текстових файлах Unicode, як і у звичайних текстових файлах, може бути
використано розриви рядків \s-1DOS,\s0 Unix або Mac.
.PP
Усі версії dos2unix та unix2dos здатні виконувати перетворення у кодуванні
\&\s-1UTF\-8,\s0 оскільки \s-1UTF\-8\s0 було розроблено так, що зворотну сумісність з \s-1ASCII\s0
збережено.
.PP
Програми dos2unix та unix2dos, зібрані з підтримкою Unicode \s-1UTF\-16,\s0 можуть
читати текстові файли у кодуванні \s-1UTF\-16\s0 з прямим та зворотним порядком
байтів. Щоб дізнатися про те, чи було dos2unix зібрано з підтримкою \s-1UTF\-16,\s0
віддайте команду \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
У Unix/Linux файли у кодуванні \s-1UTF\-16\s0 перетворюються на файли у кодуванні
локалі. Для визначення поточного кодування символів локалі скористайтеся
командою \fIlocale\fR\|(1). Якщо перетворення виявиться неможливим, програма
повідомить про помилку перетворення і пропустить відповідний файл.
.PP
У Windows файли \s-1UTF\-16\s0 типово буде перетворено на файли \s-1UTF\-8.\s0 Обидва типи
систем, Windows та Unix/Linux, мають непогані можливості з підтримки файлів
у форматуванні \s-1UTF\-8.\s0
.PP
Кодування \s-1UTF\-16\s0 та \s-1UTF\-8\s0 є повністю сумісними. Під час перетворення не буде
втрачено жодної інформації. Якщо під час перетворення даних у кодуванні
\&\s-1UTF\-16\s0 на дані у кодуванні \s-1UTF\-8\s0 трапиться помилка, наприклад, якщо у
вхідному файлі \s-1UTF\-16\s0 міститиметься якась помилка, файл буде пропущено.
.PP
Якщо використано параметр \f(CW\*(C`\-u\*(C'\fR, файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 що і початковий файл. Використання параметра Option
\&\f(CW\*(C`\-u\*(C'\fR запобігає перетворенню даних у кодування \s-1UTF\-8.\s0
.PP
У dos2unix та unix2dos не передбачено параметра для перетворення даних у
кодуванні \s-1UTF\-8\s0 на дані у кодуванні \s-1UTF\-16.\s0
.PP
Режим перетворення \s-1ISO\s0 та 7\-бітовий режим не працюють для файлів \s-1UTF\-16.\s0
.SS "Позначка порядку байтів"
.IX Subsection "Позначка порядку байтів"
У Windows до текстових файлів у кодуванні Unicode типово дописується
позначка порядку байтів (\s-1BOM\s0), оскільки багато програм Windows (зокрема
Notepad) додають таку позначку автоматично. Див. також
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
У Unix файли у кодуванні Unicode типово не містять позначки порядку
байтів. Вважається, що кодуванням текстових файлів є те кодування, яке
визначається поточною локаллю.
.PP
Програма dos2unix може визначити, чи є кодуванням файла \s-1UTF\-16,\s0 лише якщо у
файлі міститься позначка порядку байтів. Якщо у файлі, де використано
кодування \s-1UTF\-16,\s0 немає такої позначки, dos2unix вважатиме такий файл
двійковим (бінарним).
.PP
Для перетворення файлів \s-1UTF\-16\s0 без позначки порядку байтів скористайтеся
параметром \f(CW\*(C`\-ul\*(C'\fR або \f(CW\*(C`\-ub\*(C'\fR.
.PP
Типово dos2unix не записує до файлів результатів перетворення позначки
порядку байтів (\s-1BOM\s0). Якщо використано параметр \f(CW\*(C`\-b\*(C'\fR, dos2unix запише до
файла результатів \s-1BOM,\s0 якщо \s-1BOM\s0 була у файлі початкових даних.
.PP
Типово unix2dos записує позначку порядку байтів (\s-1BOM\s0) до файла результатів,
якщо \s-1BOM\s0 є у початковому файлі. Скористайтеся параметром \f(CW\*(C`\-r\*(C'\fR, щоб вилучити
\&\s-1BOM.\s0
.PP
Dos2unix та unix2dos завжди записують до файла результатів позначку порядку
байтів (\s-1BOM\s0), якщо використано параметр \f(CW\*(C`\-m\*(C'\fR.
.SS "Приклади для Unicode"
.IX Subsection "Приклади для Unicode"
Перетворити дані з Windows \s-1UTF\-16 \s0(з позначкою порядку байтів (\s-1BOM\s0)) у
формат Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Перетворити дані у форматі Windows \s-1UTF\-16LE \s0(без \s-1BOM\s0) на дані у форматі
\&\s-1UTF\-8\s0 Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-8\s0
без \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 є китайським урядовим стандартом. Підтримка обов’язкової підмножини
стандарту \s-1GB18030\s0 є неодмінною вимогою до будь\-яких програмних продуктів,
які продаються у Китаї. Див. також <http://en.wikipedia.org/wiki/GB_18030>.
.PP
Кодування \s-1GB18030\s0 є повністю сумісним із Unicode. Його можна розглядати як
формат перетворення unicode. Подібно до \s-1UTF\-8, GB18030\s0 є сумісним із
\&\s-1ASCII. GB18030\s0 також є сумісним із кодовою сторінкою Windows 936, яку ще
називають \s-1GBK.\s0
.PP
У Unix/Linux файли \s-1UTF\-16\s0 буде перетворено до кодування \s-1GB18030,\s0 якщо
кодуванням локалі є \s-1GB18030.\s0 Зауважте, що це спрацює, лише якщо встановлено
значення країни КНР. Наприклад, у англійській локалі для Великоританії із
встановленою локаллю \f(CW\*(C`en_GB.GB18030\*(C'\fR перетворення \s-1UTF\-16\s0 на \s-1GB18030\s0 не
працюватиме, а у китайській локалі \f(CW\*(C`zh_CN.GB18030\*(C'\fR все працюватиме як слід.
.PP
У Windows для перетворення файлів \s-1UTF\-16\s0 на файли \s-1GB18030\s0 слід вказати
параметр \f(CW\*(C`\-gb\*(C'\fR.
.PP
У файлах у кодуванні \s-1GB18030\s0 може міститися позначка порядку байтів, так
само, як у файлах у кодуванні Unicode.
.SH "ПРИКЛАДИ"
.IX Header "ПРИКЛАДИ"
Прочитати вхідні дані зі стандартного джерела (stdin) і записати результат
до стандартного виведення (stdout):
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
замістити цей файл:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення
ascii. Перетворити дані у b.txt і замістити цей файл у режимі 7\-бітового
перетворення:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Перетворити файл a.txt з формату Mac на формат Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Перетворити файл a.txt з формату Unix на формат Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Перетворити дані у a.txt, замістити цей файл і зберегти часову позначку
початкового файла:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла
e.txt. Скопіювати часову позначку файла a.txt для файла e.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
записати результат до e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Перетворити дані у c.txt і записати результати до e.txt. Перетворити дані у
a.txt і замістити ними цей файл. Перетворити дані у b.txt і замістити ними
цей файл. Перетворити дані у d.txt і записати результати до f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
.IX Header "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
Для рекурсивного перетворення текстових файлів у ієрархії каталогів слід
використовувати dos2unix у поєднанні з програмами \fIfind\fR\|(1) та
\&\fIxargs\fR\|(1). Наприклад, щоб виконати перетворення усіх файлів .txt у структурі
підкаталогів поточного каталогу, віддайте таку команду:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "ЛОКАЛІЗАЦІЯ"
.IX Header "ЛОКАЛІЗАЦІЯ"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Основна мова визначається за допомогою змінної середовища \s-1LANG.\s0 Значення
змінної \s-1LANG\s0 складається з декількох частин. Перша частина записується
малими літерами і визначає код мови. Друга частина є необов’язковою,
визначає код країни і записується прописними літерами, відокремлюється від
першої частини символом підкреслювання. Передбачено також необов’язкову
третю частину: кодування. Ця частина відокремлюється від другої частини
крапкою. Ось декілька прикладів для командних оболонок стандартного типу
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=uk українська
\& export LANG=uk_UA українська, Україна
\& export LANG=ru_UA російська, Україна
\& export LANG=es_ES іспанська, Іспанія
\& export LANG=es_MX іспанська, Мексика
\& export LANG=en_US.iso88591 англійська, США, кодування Latin\-1
\& export LANG=en_GB.UTF\-8 англійська, Великобританія, кодування UTF\-8
.Ve
.Sp
Повний список мов та кодів країн наведено у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
У системах Unix для отримання даних щодо локалі можна скористатися командою
\&\fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
За допомогою змінної середовища \s-1LANGUAGE\s0 ви можете вказати список
пріоритеності мов. Записи у списку слід відокремлювати двокрапками. Програма
dos2unix надає перевагу \s-1LANGUAGE\s0 над \s-1LANG.\s0 Наприклад, перша голландська,
далі німецька: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Спочатку вам слід увімкнути локалізацію,
встановивши для змінної \s-1LANG \s0(або \s-1LC_ALL\s0) значення, відмінне від «C». Далі
ви зможете використовувати список пріоритетності мов за допомогою змінної
\&\s-1LANGUAGE.\s0 Додаткові відомості можна знайти у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Якщо вами буде вибрано мову, перекладу якою немає, буде показано стандартні
повідомлення англійською мовою.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Змінну \s-1LOCALEDIR,\s0 встановлену під час збирання програми, можна змінити за
допомогою змінної середовища \s-1DOS2UNIX_LOCALEDIR. LOCALEDIR\s0 використовується
для пошуку файлів перекладів. Типовим значенням у системах \s-1GNU\s0 є
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Переглянути поточне значення змінної \s-1LOCALEDIR\s0
можна переглянути за допомогою параметра \fB\-\-version\fR.
.Sp
Приклад (командна оболонка \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "ПОВЕРНУТЕ ЗНАЧЕННЯ"
.IX Header "ПОВЕРНУТЕ ЗНАЧЕННЯ"
Якщо завдання вдасться успішно виконати, програма поверне нульовий код
виходу. Якщо станеться системна помилка, буде повернуто код цієї
помилки. Якщо станеться якась інша помилка, буде повернуто код 1.
.PP
У режимі без повідомлень повернутим значенням завжди буде нуль, якщо вказано
правильні параметри командного рядка.
.SH "СТАНДАРТИ"
.IX Header "СТАНДАРТИ"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://uk.wikipedia.org/wiki/Carriage_return>
.PP
<http://uk.wikipedia.org/wiki/Newline>
.PP
<http://uk.wikipedia.org/wiki/Unicode>
.SH "АВТОРИ"
.IX Header "АВТОРИ"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (режим
mac2unix) \- <wuebben@kde.org>, Christian Wurll (додатковий новий рядок) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (супровідник)
.PP
Сторінка проекту: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Сторінка на SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
.IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)

View File

@@ -1,796 +0,0 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "dos2unix 1"
.TH dos2unix 1 "2015-02-11" "dos2unix" "2015-02-11"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "НАЗВА"
.IX Header "НАЗВА"
dos2unix \- програма для перетворення даних у текстовому форматі DOS/Mac у
формат Unix, і навпаки
.SH "КОРОТКИЙ ОПИС"
.IX Header "КОРОТКИЙ ОПИС"
.Vb 2
\& dos2unix [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
\& unix2dos [параметри] [ФАЙЛ ...] [\-n ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...]
.Ve
.SH "ОПИС"
.IX Header "ОПИС"
До складу пакунка Dos2unix включено програми \f(CW\*(C`dos2unix\*(C'\fR та \f(CW\*(C`unix2dos\*(C'\fR,
призначені для перетворення звичайних текстових даних у форматі \s-1DOS\s0 або Mac
на дані у форматі Unix, і навпаки.
.PP
У текстових файлах DOS/Windows розрив рядка або перехід на новий рядок
здійснюється за допомогою комбінації двох символів: повернення каретки (\s-1CR\s0)
і переведення рядка (\s-1LF\s0). У текстових файлах Unix за перехід на новий рядок
відповідає один символ: переведення рядка (\s-1LF\s0). У текстових файлах Mac, до
Mac \s-1OS X,\s0 за розрив рядка відповідав один символ: повернення каретки (\s-1CR\s0). У
сучасних версіях Mac \s-1OS\s0 використовується типовий для Unix розрив рядка (\s-1LF\s0).
.PP
Окрім символів розриву рядка, програма Dos2unix здатна виконувати
перетворення кодування файлів. Можна перетворити дані у декількох кодуваннях
\&\s-1DOS\s0 на файли у кодуванні Latin\-1 Unix. Також можна перетворити дані у файлах
Windows Unicode (\s-1UTF\-16\s0) на дані у кодуванні Unix Unicode (\s-1UTF\-8\s0).
.PP
Під час перетворення програма пропускатиме двійкові файли, якщо ви не
накажете їй виконати перетворення таких файлів безпосередньо.
.PP
Програма автоматично пропускатиме файли, які не є звичайними файлами,
зокрема каталоги та канали \s-1FIFO.\s0
.PP
Типово, програма не вноситиме змін до символічних посилань та об’єктів
посилань. Якщо потрібно, програма може замінити символічні посилання або
записати перетворені дані до файла\-призначення символічного посилання. У
Windows запису до об’єкта символічного посилання не передбачено.
.PP
Програму dos2unix було створено за зразком програми dos2unix для
SunOS/Solaris. Втім, існує одна важлива відмінність від оригінальної версії
для SunOS/Solaris. Ця версія типово виконує заміну файлів під час
перетворення (старий режим обробки файлів), а у оригінальній версії для
SunOS/Solaris передбачено підтримку лише парного перетворення (новий режим
обробки файлів). Див. також параметри \f(CW\*(C`\-o\*(C'\fR та \f(CW\*(C`\-n\*(C'\fR.
.SH "ПАРАМЕТРИ"
.IX Header "ПАРАМЕТРИ"
.IP "\fB\-\-\fR" 4
.IX Item "--"
Вважати усі наступні параметри назвами файлів. Цим параметром слід
користуватися, якщо вам потрібно виконати перетворення файлів, чиї назви
містять дефіси. Наприклад, щоб виконати перетворення файла «\-foo»,
скористайтеся такою командою:
.Sp
.Vb 1
\& dos2unix \-\- \-foo
.Ve
.Sp
Або у новому режимі файлів:
.Sp
.Vb 1
\& dos2unix \-n \-\- \-foo out.txt
.Ve
.IP "\fB\-ascii\fR" 4
.IX Item "-ascii"
Виконати лише перетворення символів розриву рядків. Типовий режим
перетворення.
.IP "\fB\-iso\fR" 4
.IX Item "-iso"
Виконати перетворення з кодування \s-1DOS\s0 на кодування \s-1ISO\-8859\-1.\s0 Див. розділ
щодо режимів перетворення.
.IP "\fB\-1252\fR" 4
.IX Item "-1252"
Використати кодову таблицю 1252 Windows (західноєвропейські мови).
.IP "\fB\-437\fR" 4
.IX Item "-437"
Використовувати кодову сторінку \s-1DOS 437 \s0(США). Це типова кодова сторінка для
перетворення \s-1ISO.\s0
.IP "\fB\-850\fR" 4
.IX Item "-850"
Використовувати кодову сторінку \s-1DOS 850 \s0(західноєвропейські мови).
.IP "\fB\-860\fR" 4
.IX Item "-860"
Використовувати сторінку \s-1DOS 860 \s0(португальська).
.IP "\fB\-863\fR" 4
.IX Item "-863"
Використовувати сторінку \s-1DOS 863 \s0(канадська французька).
.IP "\fB\-865\fR" 4
.IX Item "-865"
Використовувати сторінку \s-1DOS 865 \s0(скандинавські мови).
.IP "\fB\-7\fR" 4
.IX Item "-7"
Перетворювати 8\-бітові символи на 7\-бітові.
.IP "\fB\-b, \-\-keep\-bom\fR" 4
.IX Item "-b, --keep-bom"
Зберегти позначку порядку байтів (\s-1BOM\s0). Якщо у файлі вхідних даних є \s-1BOM,\s0
записати \s-1BOM\s0 до файла результатів. Це типова поведінка під час перетворення
у формат із символами розриву рядків \s-1DOS.\s0 Див. також параметр \f(CW\*(C`\-r\*(C'\fR.
.IP "\fB\-c, \-\-convmode РЕЖИМ\fR" 4
.IX Item "-c, --convmode РЕЖИМ"
Встановити режим перетворення. Значенням аргументу РЕЖИМ може бути один з
таких рядків: \fIascii\fR, \fI7bit\fR, \fIiso\fR, \fImac\fR. Типовим є режим ascii.
.IP "\fB\-f, \-\-force\fR" 4
.IX Item "-f, --force"
Примусове перетворення двійкових файлів.
.IP "\fB\-gb, \-\-gb18030\fR" 4
.IX Item "-gb, --gb18030"
У Windows файли в \s-1UTF\-16\s0 типово перетворюються на файли в \s-1UTF\-8,\s0 незалежно
від встановленої локалі. За допомогою цього параметра ви можете наказати
програмі перетворювати файли в \s-1UTF\-16\s0 на файли у \s-1GB18030.\s0 Цим параметром
можна скористатися лише у Windows. Див. також розділ, присвячений \s-1GB18030.\s0
.IP "\fB\-h, \-\-help\fR" 4
.IX Item "-h, --help"
Показати довідкові дані і завершити роботу.
.IP "\fB\-i[ПРАПОРЦІ], \-\-info[=ПРАПОРЦІ] ФАЙЛ ...\fR" 4
.IX Item "-i[ПРАПОРЦІ], --info[=ПРАПОРЦІ] ФАЙЛ ..."
Вивести дані щодо файла. Не виконувати перетворення.
.Sp
Буде виведено такі дані, у вказаному порядку: кількість розривів рядків у
форматі \s-1DOS,\s0 кількість розривів рядків у форматі Unix, кількість розривів
рядків у форматі Mac, позначка порядку байтів, текстовим чи бінарним є файл
та назву файла.
.Sp
Приклад результатів:
.Sp
.Vb 8
\& 6 0 0 no_bom text dos.txt
\& 0 6 0 no_bom text unix.txt
\& 0 0 6 no_bom text mac.txt
\& 6 6 6 no_bom text mixed.txt
\& 50 0 0 UTF\-16LE text utf16le.txt
\& 0 50 0 no_bom text utf8unix.txt
\& 50 0 0 UTF\-8 text utf8dos.txt
\& 2 418 219 no_bom binary dos2unix.exe
.Ve
.Sp
Крім того, можна вказати додаткові прапорці для внесення змін у виведені
дані. Можна використовувати один або декілька таких прапорців.
.RS 4
.IP "\fBd\fR" 4
.IX Item "d"
Вивести кількість символів розривів рядка \s-1DOS.\s0
.IP "\fBu\fR" 4
.IX Item "u"
Вивести кількість символів розривів рядка Unix.
.IP "\fBm\fR" 4
.IX Item "m"
Вивести кількість символів розривів рядка Mac.
.IP "\fBb\fR" 4
.IX Item "b"
Вивести позначку порядку байтів.
.IP "\fBt\fR" 4
.IX Item "t"
Вивести дані щодо того, є файл текстовим чи бінарним.
.IP "\fBc\fR" 4
.IX Item "c"
Вивести дані лише тих файлів, які було б перетворено.
.Sp
Із прапорцем \f(CW\*(C`c\*(C'\fR dos2unix виведе лише назви файлів, у яких містяться
розриви рядків \s-1DOS.\s0 unix2dos виведе лише назви файлів, у яких містяться
розриви рядків Unix.
.RE
.RS 4
.Sp
Приклади:
.Sp
Вивести дані щодо усіх файлів *.txt:
.Sp
.Vb 1
\& dos2unix \-i *.txt
.Ve
.Sp
Вивести кількість розривів рядків у форматі \s-1DOS\s0 і розривів рядків у форматі
Unix:
.Sp
.Vb 1
\& dos2unix \-idu *.txt
.Ve
.Sp
Вивести лише позначку порядку байтів:
.Sp
.Vb 1
\& dos2unix \-\-info=b *.txt
.Ve
.Sp
Вивести список файлів, у яких є символи розриву рядків \s-1DOS:\s0
.Sp
.Vb 1
\& dos2unix \-ic *.txt
.Ve
.Sp
Вивести список файлів, у яких використано символи розриву рядків Unix:
.Sp
.Vb 1
\& unix2dos \-ic *.txt
.Ve
.RE
.IP "\fB\-k, \-\-keepdate\fR" 4
.IX Item "-k, --keepdate"
Зберегти часову позначку файла вхідних даних у файлі результатів
перетворення.
.IP "\fB\-L, \-\-license\fR" 4
.IX Item "-L, --license"
Вивести умови ліцензування програми.
.IP "\fB\-l, \-\-newline\fR" 4
.IX Item "-l, --newline"
Вставити додатковий символ розриву рядка.
.Sp
\&\fBdos2unix\fR: перетворення на два символи розриву рядків Unix відбуватиметься
лише для комбінацій розриву рядків \s-1DOS.\s0 У режимі Mac виконуватиметься
перетворення на два розриви рядків Unix лише символів розриву рядків Mac.
.Sp
\&\fBunix2dos\fR: перетворення на дві комбінації розриву рядків \s-1DOS\s0
відбуватиметься лише для символів розриву рядків \s-1DOS.\s0 У режимі Mac
виконуватиметься перетворення на два розриви рядків Mac лише символів
розриву рядків Unix.
.IP "\fB\-m, \-\-add\-bom\fR" 4
.IX Item "-m, --add-bom"
Записати до файла результатів позначку порядку байтів (\s-1BOM\s0). Типово буде
записано позначку порядку байтів \s-1UTF\-8.\s0
.Sp
Якщо дані початкового файла закодовано у \s-1UTF\-16\s0 і використано параметр
\&\f(CW\*(C`\-u\*(C'\fR, буде дописано позначку порядку байтів \s-1UTF\-16.\s0
.Sp
Не використовуйте цей параметр для кодувань результатів, відмінних від \s-1UTF\-8\s0
або \s-1UTF\-16.\s0 Див. також розділ щодо \s-1UNICODE.\s0
.IP "\fB\-n, \-\-newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ...\fR" 4
.IX Item "-n, --newfile ВХІДНИЙ_ФАЙЛ ВИХІДНИЙ_ФАЙЛ ..."
Новий режим обробки файлів. Перетворити дані з файла ВХІДНИЙ_ФАЙЛ і записати
результати до файла ВИХІДНИЙ_ФАЙЛ. Назви файлів слід вказувати парами, \fIне
слід\fR використовувати шаблони заміни, інакше вміст файлів \fIбуде втрачено\fR.
.Sp
Власником перетвореного файла буде призначено користувача, яким було
розпочато перетворення у режимі нового файла (парному режимі). Права доступу
на читання або запис нового файла буде визначено на основі прав доступу до
початкового файла мінус \fIumask\fR\|(1) для користувача, яким було розпочато
перетворення.
.IP "\fB\-o, \-\-oldfile ФАЙЛ ...\fR" 4
.IX Item "-o, --oldfile ФАЙЛ ..."
Застарілий режим обробки. Виконати перетворення файла ФАЙЛ і перезаписати
його вміст. Типово, програма працює у цьому режимі. Можна використовувати
шаблони заміни.
.Sp
У застарілому режимі (режимі заміщення) перетворений файл належатиме тому
самому власнику і групі і матиме ті самі права доступу на читання або запис,
що і початковий файл. Крім того, якщо перетворення файла виконується іншим
користувачем, який має права доступу на запис до файла (наприклад
користувачем root), перетворення буде перервано, якщо зберегти початкові
значення не вдасться. Зміна власника може означати неможливість читання
файла для його початкового власника. Зміна групи може призвести до проблем
із безпекою, оскільки файл може стати доступним для читання користувачам,
які не повинні мати такі права доступу. Можливість збереження прав власності
та прав доступу до файла передбачено лише у Unix.
.IP "\fB\-q, \-\-quiet\fR" 4
.IX Item "-q, --quiet"
Режим без виведення повідомлень. Програма не виводитиме жодних попереджень
або повідомлень про помилки. Повернутим значенням завжди буде нуль, якщо
вказано правильні параметри командного рядка.
.IP "\fB\-r, \-\-remove\-bom\fR" 4
.IX Item "-r, --remove-bom"
Вилучити позначку порядку байтів (\s-1BOM\s0). Не записувати \s-1BOM\s0 до файла
результатів. Це типова поведінка під час перетворення файлів з форматом
розриву рядків Unix. Див. також параметр \f(CW\*(C`\-b\*(C'\fR.
.IP "\fB\-s, \-\-safe\fR" 4
.IX Item "-s, --safe"
Пропускати двійкові файли (типово).
.IP "\fB\-u, \-\-keep\-utf16\fR" 4
.IX Item "-u, --keep-utf16"
Зберегти початкове кодування \s-1UTF\-16.\s0 Файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 із прямим або зворотним порядком байтів, що і
початковий файл. Таким чином можна запобігти перетворенню даних у кодування
\&\s-1UTF\-8.\s0 До файла буде записано відповідну позначку порядку байтів
\&\s-1UTF\-16.\s0 Вимкнути цей параметр можна за допомогою параметра \f(CW\*(C`\-ascii\*(C'\fR.
.IP "\fB\-ul, \-\-assume\-utf16le\fR" 4
.IX Item "-ul, --assume-utf16le"
Припускати, що кодуванням вхідних файлів є \s-1UTF\-16LE.\s0
.Sp
Якщо у початковому файлі є позначка порядку байтів (\s-1BOM\s0), її буде
використано у файлі\-результаті, незалежно від використання цього параметра.
.Sp
Якщо вами було зроблено помилкове припущення щодо формату файла (файл
вхідних даних насправді не є файлом у форматі \s-1UTF\-16LE\s0), і дані вдасться
успішно перетворити, ви отримаєте файл у кодуванні \s-1UTF\-8\s0 з помилковим
вмістом. Скасувати таке помилкове перетворення можна за допомогою зворотного
перетворення \fIiconv\fR\|(1) з даних у форматі \s-1UTF\-8\s0 на дані у форматі
\&\s-1UTF\-16LE.\s0 Таким чином ви повернетеся до початкового кодування даних у файлі.
.Sp
Припущення щодо форматування \s-1UTF\-16LE\s0 працює як визначення \fIрежиму
перетворення\fR. Перемиканням на типовий режим \fIascii\fR можна вимкнути
припущення щодо форматування \s-1UTF\-16LE.\s0
.IP "\fB\-ub, \-\-assume\-utf16be\fR" 4
.IX Item "-ub, --assume-utf16be"
Припускати, що вхідним форматом є \s-1UTF\-16BE.\s0
.Sp
Цей параметр працює у спосіб, тотожний до параметра \f(CW\*(C`\-ul\*(C'\fR.
.IP "\fB\-v, \-\-verbose\fR" 4
.IX Item "-v, --verbose"
Виводити докладні повідомлення. Буде показано додаткові дані щодо позначок
порядку байтів та кількості перетворених символів розриву рядків.
.IP "\fB\-F, \-\-follow\-symlink\fR" 4
.IX Item "-F, --follow-symlink"
Переходити за символічними посиланням і перетворювати файли, на які вони
вказують.
.IP "\fB\-R, \-\-replace\-symlink\fR" 4
.IX Item "-R, --replace-symlink"
Замінити символічні посилання перетвореними файлами (початкові файли, на які
вони вказують, змінено не буде).
.IP "\fB\-S, \-\-skip\-symlink\fR" 4
.IX Item "-S, --skip-symlink"
Не змінювати символічні посилання та файли, на які вони посилаються
(типово).
.IP "\fB\-V, \-\-version\fR" 4
.IX Item "-V, --version"
Вивести дані щодо версії і завершити роботу.
.SH "РЕЖИМ MAC"
.IX Header "РЕЖИМ MAC"
У звичайному режимі розриви рядків \s-1DOS\s0 перетворюються на розриви рядків
Unix, і навпаки. Розриви рядків Mac перетворенню не підлягають.
.PP
У режимі Mac розриви рядків Mac перетворюються на розриви рядків Unix, і
навпаки. Розриви рядків \s-1DOS\s0 перетворенню не підлягають.
.PP
Щоб запустити програму у режимі перетворення Mac, скористайтеся параметром
командного рядка \f(CW\*(C`\-c mac\*(C'\fR або програмами \f(CW\*(C`mac2unix\*(C'\fR та \f(CW\*(C`unix2mac\*(C'\fR.
.SH "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IX Header "РЕЖИМИ ПЕРЕТВОРЕННЯ"
.IP "\fBascii\fR" 4
.IX Item "ascii"
У режимі \f(CW\*(C`ascii\*(C'\fR виконуватиметься лише перетворення символів розриву
рядків. Цей режим є типовим режимом перетворення.
.Sp
Хоча цей режим і називається режимом \s-1ASCII \s0(стандарту 7\-бітового кодування),
насправді кодування символів у ньому є 8\-бітовим. Завжди користуйтеся цим
режимом для перетворення файлів у кодуванні \s-1UTF\-8 \s0(Unicode).
.IP "\fB7bit\fR" 4
.IX Item "7bit"
У цьому режимі усі 8\-бітові символи, які не є частиною \s-1ASCII, \s0(з номерами
від 128 до 255) буде перетворено на відповідні 7\-бітові символи.
.IP "\fBiso\fR" 4
.IX Item "iso"
Перетворення символів буде виконано з кодування (кодової сторінки) \s-1DOS\s0 до
кодування \s-1ISO\-8859\-1 \s0(Latin\-1) у Unix. Символи \s-1DOS,\s0 які не мають
еквівалентів у \s-1ISO\-8859\-1\s0 і перетворення яких неможливе, буде перетворено на
символ крапки. Те саме стосується символів \s-1ISO\-8859\-1,\s0 які не мають
еквівалентів у \s-1DOS.\s0
.Sp
Якщо буде використано лише параметр \f(CW\*(C`\-iso\*(C'\fR, програма dos2unix спробує
визначити активне кодування. Якщо це виявиться неможливим, dos2unix
використає типове кодування \s-1CP437,\s0 яке здебільшого використовується у
США. Щоб примусово визначити кодування, скористайтеся параметром \f(CW\*(C`\-437\*(C'\fR
(США), \f(CW\*(C`\-850\*(C'\fR (західноєвропейські мови), \f(CW\*(C`\-860\*(C'\fR (португальська), \f(CW\*(C`\-863\*(C'\fR
(канадська французька) або \f(CW\*(C`\-865\*(C'\fR (скандинавські мови). Використати
кодування Windows \s-1CP1252 \s0(західноєвропейські мови) можна за допомогою
параметра \f(CW\*(C`\-1252\*(C'\fR. Для інших кодувань використовуйте поєднання dos2unix з
\&\fIiconv\fR\|(1). Програма iconv здатна виконувати перетворення даних у доволі
широкому спектрі кодувань символів.
.Sp
Ніколи не користуйтеся перетворенням \s-1ISO\s0 для текстових файлів у форматі
Unicode. Використання подібного перетворення призведе до ушкодження вмісту
файлів у кодуванні \s-1UTF\-8.\s0
.Sp
Декілька прикладів:
.Sp
Перетворити дані у типовому кодуванні \s-1DOS\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1DOS CP850\s0 на дані у кодуванні Latin\-1 Unix:
.Sp
.Vb 1
\& dos2unix \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP1252\s0 Windows на дані у кодуванні Latin\-1
Unix:
.Sp
.Vb 1
\& dos2unix \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1CP252\s0 Windows на дані у кодуванні \s-1UTF\-8\s0 Unix
(Unicode):
.Sp
.Vb 1
\& iconv \-f CP1252 \-t UTF\-8 in.txt | dos2unix > out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у типовому кодуванні \s-1DOS:\s0
.Sp
.Vb 1
\& unix2dos \-iso \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні \s-1DOS CP850:\s0
.Sp
.Vb 1
\& unix2dos \-850 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні Latin\-1 Unix на дані у кодуванні Windows
\&\s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos \-1252 \-n in.txt out.txt
.Ve
.Sp
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix (Unicode) на дані у кодуванні
Windows \s-1CP1252:\s0
.Sp
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t CP1252 > out.txt
.Ve
.Sp
Див. також <http://czyborra.com/charsets/codepages.html> та
<http://czyborra.com/charsets/iso8859.html>.
.SH "UNICODE"
.IX Header "UNICODE"
.SS "Кодування"
.IX Subsection "Кодування"
Існує декілька різних кодувань Unicode. У Unix та Linux у файлах Unicode
здебільшого використовується кодування \s-1UTF\-8.\s0 У Windows для текстових файлів
Unicode може бути використано кодування \s-1UTF\-8, UTF\-16\s0 або \s-1UTF\-16\s0 зі
зворотним порядком байтів. Втім, здебільшого, використовується формат
\&\s-1UTF\-16.\s0
.SS "Перетворення"
.IX Subsection "Перетворення"
У текстових файлах Unicode, як і у звичайних текстових файлах, може бути
використано розриви рядків \s-1DOS,\s0 Unix або Mac.
.PP
Усі версії dos2unix та unix2dos здатні виконувати перетворення у кодуванні
\&\s-1UTF\-8,\s0 оскільки \s-1UTF\-8\s0 було розроблено так, що зворотну сумісність з \s-1ASCII\s0
збережено.
.PP
Програми dos2unix та unix2dos, зібрані з підтримкою Unicode \s-1UTF\-16,\s0 можуть
читати текстові файли у кодуванні \s-1UTF\-16\s0 з прямим та зворотним порядком
байтів. Щоб дізнатися про те, чи було dos2unix зібрано з підтримкою \s-1UTF\-16,\s0
віддайте команду \f(CW\*(C`dos2unix \-V\*(C'\fR.
.PP
У Unix/Linux файли у кодуванні \s-1UTF\-16\s0 перетворюються на файли у кодуванні
локалі. Для визначення поточного кодування символів локалі скористайтеся
командою \fIlocale\fR\|(1). Якщо перетворення виявиться неможливим, програма
повідомить про помилку перетворення і пропустить відповідний файл.
.PP
У Windows файли \s-1UTF\-16\s0 типово буде перетворено на файли \s-1UTF\-8.\s0 Обидва типи
систем, Windows та Unix/Linux, мають непогані можливості з підтримки файлів
у форматуванні \s-1UTF\-8.\s0
.PP
Кодування \s-1UTF\-16\s0 та \s-1UTF\-8\s0 є повністю сумісними. Під час перетворення не буде
втрачено жодної інформації. Якщо під час перетворення даних у кодуванні
\&\s-1UTF\-16\s0 на дані у кодуванні \s-1UTF\-8\s0 трапиться помилка, наприклад, якщо у
вхідному файлі \s-1UTF\-16\s0 міститиметься якась помилка, файл буде пропущено.
.PP
Якщо використано параметр \f(CW\*(C`\-u\*(C'\fR, файл результатів буде записано у тому
самому кодуванні \s-1UTF\-16,\s0 що і початковий файл. Використання параметра Option
\&\f(CW\*(C`\-u\*(C'\fR запобігає перетворенню даних у кодування \s-1UTF\-8.\s0
.PP
У dos2unix та unix2dos не передбачено параметра для перетворення даних у
кодуванні \s-1UTF\-8\s0 на дані у кодуванні \s-1UTF\-16.\s0
.PP
Режим перетворення \s-1ISO\s0 та 7\-бітовий режим не працюють для файлів \s-1UTF\-16.\s0
.SS "Позначка порядку байтів"
.IX Subsection "Позначка порядку байтів"
У Windows до текстових файлів у кодуванні Unicode типово дописується
позначка порядку байтів (\s-1BOM\s0), оскільки багато програм Windows (зокрема
Notepad) додають таку позначку автоматично. Див. також
<http://en.wikipedia.org/wiki/Byte_order_mark>.
.PP
У Unix файли у кодуванні Unicode типово не містять позначки порядку
байтів. Вважається, що кодуванням текстових файлів є те кодування, яке
визначається поточною локаллю.
.PP
Програма dos2unix може визначити, чи є кодуванням файла \s-1UTF\-16,\s0 лише якщо у
файлі міститься позначка порядку байтів. Якщо у файлі, де використано
кодування \s-1UTF\-16,\s0 немає такої позначки, dos2unix вважатиме такий файл
двійковим (бінарним).
.PP
Для перетворення файлів \s-1UTF\-16\s0 без позначки порядку байтів скористайтеся
параметром \f(CW\*(C`\-ul\*(C'\fR або \f(CW\*(C`\-ub\*(C'\fR.
.PP
Типово dos2unix не записує до файлів результатів перетворення позначки
порядку байтів (\s-1BOM\s0). Якщо використано параметр \f(CW\*(C`\-b\*(C'\fR, dos2unix запише до
файла результатів \s-1BOM,\s0 якщо \s-1BOM\s0 була у файлі початкових даних.
.PP
Типово unix2dos записує позначку порядку байтів (\s-1BOM\s0) до файла результатів,
якщо \s-1BOM\s0 є у початковому файлі. Скористайтеся параметром \f(CW\*(C`\-r\*(C'\fR, щоб вилучити
\&\s-1BOM.\s0
.PP
Dos2unix та unix2dos завжди записують до файла результатів позначку порядку
байтів (\s-1BOM\s0), якщо використано параметр \f(CW\*(C`\-m\*(C'\fR.
.SS "Приклади для Unicode"
.IX Subsection "Приклади для Unicode"
Перетворити дані з Windows \s-1UTF\-16 \s0(з позначкою порядку байтів (\s-1BOM\s0)) у
формат Unix \s-1UTF\-8:\s0
.PP
.Vb 1
\& dos2unix \-n in.txt out.txt
.Ve
.PP
Перетворити дані у форматі Windows \s-1UTF\-16LE \s0(без \s-1BOM\s0) на дані у форматі
\&\s-1UTF\-8\s0 Unix:
.PP
.Vb 1
\& dos2unix \-ul \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-8\s0
без \s-1BOM:\s0
.PP
.Vb 1
\& unix2dos \-m \-n in.txt out.txt
.Ve
.PP
Перетворити дані у кодуванні \s-1UTF\-8\s0 Unix на дані у кодуванні Windows \s-1UTF\-16:\s0
.PP
.Vb 1
\& unix2dos < in.txt | iconv \-f UTF\-8 \-t UTF\-16 > out.txt
.Ve
.SH "GB18030"
.IX Header "GB18030"
\&\s-1GB18030\s0 є китайським урядовим стандартом. Підтримка обов’язкової підмножини
стандарту \s-1GB18030\s0 є неодмінною вимогою до будь\-яких програмних продуктів,
які продаються у Китаї. Див. також <http://en.wikipedia.org/wiki/GB_18030>.
.PP
Кодування \s-1GB18030\s0 є повністю сумісним із Unicode. Його можна розглядати як
формат перетворення unicode. Подібно до \s-1UTF\-8, GB18030\s0 є сумісним із
\&\s-1ASCII. GB18030\s0 також є сумісним із кодовою сторінкою Windows 936, яку ще
називають \s-1GBK.\s0
.PP
У Unix/Linux файли \s-1UTF\-16\s0 буде перетворено до кодування \s-1GB18030,\s0 якщо
кодуванням локалі є \s-1GB18030.\s0 Зауважте, що це спрацює, лише якщо встановлено
значення країни КНР. Наприклад, у англійській локалі для Великоританії із
встановленою локаллю \f(CW\*(C`en_GB.GB18030\*(C'\fR перетворення \s-1UTF\-16\s0 на \s-1GB18030\s0 не
працюватиме, а у китайській локалі \f(CW\*(C`zh_CN.GB18030\*(C'\fR все працюватиме як слід.
.PP
У Windows для перетворення файлів \s-1UTF\-16\s0 на файли \s-1GB18030\s0 слід вказати
параметр \f(CW\*(C`\-gb\*(C'\fR.
.PP
У файлах у кодуванні \s-1GB18030\s0 може міститися позначка порядку байтів, так
само, як у файлах у кодуванні Unicode.
.SH "ПРИКЛАДИ"
.IX Header "ПРИКЛАДИ"
Прочитати вхідні дані зі стандартного джерела (stdin) і записати результат
до стандартного виведення (stdout):
.PP
.Vb 2
\& dos2unix
\& dos2unix \-l \-c mac
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
замістити цей файл:
.PP
.Vb 2
\& dos2unix a.txt b.txt
\& dos2unix \-o a.txt b.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення ascii:
.PP
.Vb 1
\& dos2unix a.txt
.Ve
.PP
Перетворити дані у a.txt і замістити файл у режимі перетворення
ascii. Перетворити дані у b.txt і замістити цей файл у режимі 7\-бітового
перетворення:
.PP
.Vb 3
\& dos2unix a.txt \-c 7bit b.txt
\& dos2unix \-c ascii a.txt \-c 7bit b.txt
\& dos2unix \-ascii a.txt \-7 b.txt
.Ve
.PP
Перетворити файл a.txt з формату Mac на формат Unix:
.PP
.Vb 2
\& dos2unix \-c mac a.txt
\& mac2unix a.txt
.Ve
.PP
Перетворити файл a.txt з формату Unix на формат Mac:
.PP
.Vb 2
\& unix2dos \-c mac a.txt
\& unix2mac a.txt
.Ve
.PP
Перетворити дані у a.txt, замістити цей файл і зберегти часову позначку
початкового файла:
.PP
.Vb 2
\& dos2unix \-k a.txt
\& dos2unix \-k \-o a.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла e.txt:
.PP
.Vb 1
\& dos2unix \-n a.txt e.txt
.Ve
.PP
Перетворити дані у файлі a.txt і записати результати до файла
e.txt. Скопіювати часову позначку файла a.txt для файла e.txt:
.PP
.Vb 1
\& dos2unix \-k \-n a.txt e.txt
.Ve
.PP
Перетворити дані у a.txt і замістити цей файл. Перетворити дані у b.txt і
записати результат до e.txt:
.PP
.Vb 2
\& dos2unix a.txt \-n b.txt e.txt
\& dos2unix \-o a.txt \-n b.txt e.txt
.Ve
.PP
Перетворити дані у c.txt і записати результати до e.txt. Перетворити дані у
a.txt і замістити ними цей файл. Перетворити дані у b.txt і замістити ними
цей файл. Перетворити дані у d.txt і записати результати до f.txt:
.PP
.Vb 1
\& dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
.Ve
.SH "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
.IX Header "РЕКУРСИВНЕ ПЕРЕТВОРЕННЯ"
Для рекурсивного перетворення текстових файлів у ієрархії каталогів слід
використовувати dos2unix у поєднанні з програмами \fIfind\fR\|(1) та
\&\fIxargs\fR\|(1). Наприклад, щоб виконати перетворення усіх файлів .txt у структурі
підкаталогів поточного каталогу, віддайте таку команду:
.PP
.Vb 1
\& find . \-name *.txt |xargs dos2unix
.Ve
.SH "ЛОКАЛІЗАЦІЯ"
.IX Header "ЛОКАЛІЗАЦІЯ"
.IP "\fB\s-1LANG\s0\fR" 4
.IX Item "LANG"
Основна мова визначається за допомогою змінної середовища \s-1LANG.\s0 Значення
змінної \s-1LANG\s0 складається з декількох частин. Перша частина записується
малими літерами і визначає код мови. Друга частина є необов’язковою,
визначає код країни і записується прописними літерами, відокремлюється від
першої частини символом підкреслювання. Передбачено також необов’язкову
третю частину: кодування. Ця частина відокремлюється від другої частини
крапкою. Ось декілька прикладів для командних оболонок стандартного типу
\&\s-1POSIX:\s0
.Sp
.Vb 7
\& export LANG=uk українська
\& export LANG=uk_UA українська, Україна
\& export LANG=ru_UA російська, Україна
\& export LANG=es_ES іспанська, Іспанія
\& export LANG=es_MX іспанська, Мексика
\& export LANG=en_US.iso88591 англійська, США, кодування Latin\-1
\& export LANG=en_GB.UTF\-8 англійська, Великобританія, кодування UTF\-8
.Ve
.Sp
Повний список мов та кодів країн наведено у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/Usual\-Language\-Codes.html>
.Sp
У системах Unix для отримання даних щодо локалі можна скористатися командою
\&\fIlocale\fR\|(1).
.IP "\fB\s-1LANGUAGE\s0\fR" 4
.IX Item "LANGUAGE"
За допомогою змінної середовища \s-1LANGUAGE\s0 ви можете вказати список
пріоритеності мов. Записи у списку слід відокремлювати двокрапками. Програма
dos2unix надає перевагу \s-1LANGUAGE\s0 над \s-1LANG.\s0 Наприклад, перша голландська,
далі німецька: \f(CW\*(C`LANGUAGE=nl:de\*(C'\fR. Спочатку вам слід увімкнути локалізацію,
встановивши для змінної \s-1LANG \s0(або \s-1LC_ALL\s0) значення, відмінне від «C». Далі
ви зможете використовувати список пріоритетності мов за допомогою змінної
\&\s-1LANGUAGE.\s0 Додаткові відомості можна знайти у підручнику з gettext:
<http://www.gnu.org/software/gettext/manual/html_node/The\-LANGUAGE\-variable.html>
.Sp
Якщо вами буде вибрано мову, перекладу якою немає, буде показано стандартні
повідомлення англійською мовою.
.IP "\fB\s-1DOS2UNIX_LOCALEDIR\s0\fR" 4
.IX Item "DOS2UNIX_LOCALEDIR"
Змінну \s-1LOCALEDIR,\s0 встановлену під час збирання програми, можна змінити за
допомогою змінної середовища \s-1DOS2UNIX_LOCALEDIR. LOCALEDIR\s0 використовується
для пошуку файлів перекладів. Типовим значенням у системах \s-1GNU\s0 є
\&\f(CW\*(C`/usr/local/share/locale\*(C'\fR. Переглянути поточне значення змінної \s-1LOCALEDIR\s0
можна переглянути за допомогою параметра \fB\-\-version\fR.
.Sp
Приклад (командна оболонка \s-1POSIX\s0):
.Sp
.Vb 1
\& export DOS2UNIX_LOCALEDIR=$HOME/share/locale
.Ve
.SH "ПОВЕРНУТЕ ЗНАЧЕННЯ"
.IX Header "ПОВЕРНУТЕ ЗНАЧЕННЯ"
Якщо завдання вдасться успішно виконати, програма поверне нульовий код
виходу. Якщо станеться системна помилка, буде повернуто код цієї
помилки. Якщо станеться якась інша помилка, буде повернуто код 1.
.PP
У режимі без повідомлень повернутим значенням завжди буде нуль, якщо вказано
правильні параметри командного рядка.
.SH "СТАНДАРТИ"
.IX Header "СТАНДАРТИ"
<http://en.wikipedia.org/wiki/Text_file>
.PP
<http://uk.wikipedia.org/wiki/Carriage_return>
.PP
<http://uk.wikipedia.org/wiki/Newline>
.PP
<http://uk.wikipedia.org/wiki/Unicode>
.SH "АВТОРИ"
.IX Header "АВТОРИ"
Benjamin Lin \- <blin@socs.uts.edu.au>, Bernd Johannes Wuebben (режим
mac2unix) \- <wuebben@kde.org>, Christian Wurll (додатковий новий рядок) \-
<wurll@ira.uka.de>, Erwin Waterlander \- <waterlan@xs4all.nl> (супровідник)
.PP
Сторінка проекту: <http://waterlan.home.xs4all.nl/dos2unix.html>
.PP
Сторінка на SourceForge: <http://sourceforge.net/projects/dos2unix/>
.SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
.IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
\&\fIfile\fR\|(1) \fIfind\fR\|(1) \fIiconv\fR\|(1) \fIlocale\fR\|(1) \fIxargs\fR\|(1)