A free Basic UNIX-training with muLinux
Notes: This Text is roughly translated (German to English) by a translating program. Sorry, but I have not time for the translation. Maybe you can do this?
In order to store this exercise on a DOS diskette, we put these into the floppy
disk drive, mounten the drive after / a and change into the directory /
a .
/ # mount /dev/fd0 /a
/ # cd /a
/ a #
Converting Text Files between DOS and Unix
Under DOS a line end becomes by the sequence in text files return (decimal
code 13) and new LINE (decimal code 10) represented. Unix uses against
it only new LINE .
If a Unix text file in DOS or Windows is continued to process, then the
representation of the line-makeup takes place not correctly. Thus become with
simple text editors, like z. B. notepad.exe , in place of a page
make-up only strange characters represented. More fastidious text editors, e.g.
the Windows version of vi , also Unix text files can correctly read.
Becomes a DOS text file into that vi - wordprocessor loaded, then
appears ^M - characters at each line end.
In order to avoid problems, the text files should be converted.
There are two programs for it under Unix.
unix2dos Converted of Unix to DOS and dosùnix Converted of DOS
to Unix. The 2 is called in English " two ", thus like " to
" (English too) expressed unix2dos is thus actually " Unix to of DOS
" to be called.
Around a Unix text file into a DOS text file to convert the
following instruction line serves. cat outputs the file content. The
output becomes however pipe by means of directly too unix2dos rerouted.
unix2dos the each line-makeup works the character as a filter, new
LINE adds.
cat Unixtextfile | unix2dos > DOStextfile
Over e.g. a copy of the file /etc/passwd after DOS to convert and
on our DOS diskette store, we input the following instruction:
/# cd /a
/a # cat /etc/passwd | unix2dos > passwd.txt
The DOS diskette can be taken after the removal of the mount allocation from
the floppy disk drive, in order to process it thereafter in a Windows PC.
File passwd.txt can then with one doubleclick in the Windows Notepad to be edited.
Like know thus a text file with that vi write, into the DOS title format
convert and on a gemountete DOS diskette copy. Subsequently, then this text file
under DOS or Windows can be continued to process. Turned it goes naturally also.
For conversion of DOS text files in Unix text files the same
principle is used. dosùnix removed however in each case the character new
LINE .
cat DOStextfile | dos2unix > Unixtextfile
In other Unix versions the syntax of these instruction is every now and then
very different.
Around this exercise to terminate we lift those mount - allocation of
our work diskette up.
/ a # cd /
/ # umount / a
/ #
Robert.Warnke@giso.de (copyleft) Robert Warnke, Berlin (Germany) - You can write me in English. | http://rowa.giso.de
|