DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with DOS

Converting DOS files to and from UNIX system file format

Note that DOS text files contain extra formatting characters that will show up on your screen. A line of text in a UNIX system file is terminated by a line feed character. In DOS files, a line is terminated by a line feed and a carriage return (^M). Because no attempt is made to change the nature of DOS files, the carriage return character is visible when editing a DOS file from the UNIX system partition. Thus when a DOS file that contains a series of numbers is opened using vi(C), it looks something like this:

   This is a DOS file.^M
   Note that each line ends in a spurious character^M
   like this.^M
   ~
   ~
   ~
   ~
   ~
   ~
   "TEST.TXT" 3 lines, 100 characters
You can either ignore these characters, or remove them with the dtox(C) (DOS to UNIX) command. If you remove the carriage returns in a DOS file using dtox, you must replace them using the xtod(C) (UNIX to DOS) command before you use the file under DOS. The following commands convert the DOS file test.txt to and from the UNIX format file test.out:
   $ dtox test.txt > test.out
   $ xtod test.out > test.txt

Next topic: Automatic file conversions when using DOS utilities
Previous topic: Displaying a DOS file

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005