Technical Notes |
|
The Reflection NFS client provides several methods for translating ASCII file end-of-line characters from DOS (Windows) format to UNIX format, or from UNIX to DOS (Windows) format. This technical note lists and explains each of these options.
Windows (DOS) and UNIX use different non-visible characters to indicate the end of each line of text in an ASCII file. Windows uses a CRLF (Carriage Return, Line Feed) to indicate the end of a line of ASCII text, while UNIX uses only a CR (Carriage Return).
Because these end-of-line indicators differ between the two operating systems, to edit a UNIX file in Windows you must first translate the UNIX end-of-line characters to the appropriate Windows format. The opposite is true for a file created in Windows and edited in UNIX.
Warning: You risk corrupting the file if you do not translate the end-of-line characters before editing a UNIX file in Windows, or a Windows file in UNIX. Some applications display these types of files as if they have been translated, even though the actual end-of-line characters have not been changed. Editing a file that has been converted only for display can create files that contain mixed end-of-line characters and may cause file corruption.
Reflection NFS client provides several ways to perform this file format translation. The following sections detail these methods.
Note: These utilities convert only CR to CRLF, or CRLF to CR. They provide no other file translation support.
This option works only when moving files from one folder location to another. Follow the steps below to use this functionality:
Figure 1 - Menu ItemsIf the files you want to translate are on a mapped NFS drive, you can translate the end-of-line characters using the NFS Utility. Follow the steps below to use the NFS Utility's file translation options:
If you need to convert files from a Windows Command Prompt or a batch file, Attachmate provides two Reflection NFS file translation executables; Dos2unix.exe and Unix2dos.exe. These files can be obtained from the Reflection NFS Products section of the Reflection Download Library at:
As the file names indicate, Dos2unix.exe converts DOS end-of-line characters to UNIX format, and Unix2dos.exe converts UNIX end-of-line characters to DOS format. Further syntax and usage information can be obtained by typing: Dos2unix.exe /? or Unix2dos.exe /?.
Note: These utilities rely on Reflection NFS client product files, and can thus only be used on a PC where Reflection NFS client is installed.
Some host operating systems or NFS server side software provide support for automatic file translation when a file is copied or moved from the host using NFS. For further information regarding this topic, check your host documentation or contact your host vendor.