|
Quick links About dos2unix, fromdos and
todos Syntax Examples
Related commands Linux / Unix main page
About dos2unix, fromdos and todos
A utility that converts MS-DOS text files to Unix
text files, as the two systems have different ideas on what a
line separator is. The fromdos command converts text files from
the DOS format to the Unix format, while todos converts text
files from the Unix format to the DOS format.
Syntax
fromdos [ options ] [file...]
todos [ options ] [file...]
| -a |
Always convert. If converting
from DOS to Unix, this option will cause the program to
remove ALL carriage returns. The default is to remove
carriage returns only if they are followed by line feeds. If
converting from Unix to DOS, this option will cause the
program to convert ALL linefeeds to carriage return pairs.
The default is to convert linefeeds only if they are not
already preceded by a carriage return. |
| -b |
Make a backup of original file.
The original file is renamed with the original filename and
a .bak extension. |
| -d |
Convert from DOS to Unix. This
forces the program to convert the file in a particular
direction. By default, if the program is named fromdos or
dos2unix, it will assume that the input file is in a DOS
format and convert it to
a Unix format. If the program is named todos or unix2dos, it
will assume that the input file is in a Unix format and
convert it to a DOS format. Using the -d option forces the
program to convert from a DOS format to a Unix format
regardless of how the program is named. Likewise, using the
-u option forces the program to convert from a Unix format
to a DOS format regardless of the name of the program. |
| -e |
Abort processing on any error in
any file. Normally, the program will simply skip to process
the next file on the command line when it encounters any
errors. This option causes it to abort on errors. |
| -f |
Force: convert even if the file
is not writeable (read-only). By default, if fromdos or
todos finds that the file does not have write permission, it
will not process that file. This option forces the
conversion even if the file is read-only. |
| -h |
Display a short help screen on
the program usage and quit. |
| -o |
Overwrite the original file (no
backup). This is the default. |
| -p |
Preserve file ownership and
time. On systems like Linux, the file ownership will only be
preserved if the user is root, otherwise it will just set
the file time and silently fail the change of file
ownership. If you want a warning message when the file
ownership cannot be changed, use -v. |
| -u |
Convert from DOS to Unix. See
the -d option above for more information. |
| -v |
Verbose. |
| -V |
Show version message and quit. |
Examples
fromdos test.txt
The above example would take a MS-DOS or
Microsoft Windows file or other file with different line
separators and format the file with new line separators to be
read in Linux / Unix.
todos test.txt
The above example would take a file formatted
with Linux / Unix separators and format it to the format
commonly used with MS-DOS / Microsoft Windows files.
Related commands
None
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|