On the UNIX side, you can also use the dos2unix and unix2dos commands.
I have also found Sun's StarOffice to be very useful for manipulating UNIX text files on Windows systems and vice versa.
Noelette Stout Unix System Administrator IKON Office Solutions, Inc Digital Express tel. (770)326-4140 fax (770)326-4139 email: nstout@ikon.com
-----Original Message----- From: Steve Losen [mailto:scl@sasha.acc.virginia.edu] Sent: Wednesday, January 16, 2002 8:28 AM To: Frank Bonnet Cc: toasters@mathworks.com Subject: Re: ascii files convertion UNIX <--> windows ?
Hi
After success in accessing UNIX homedir from windows ( thanks to all that respond ) I am facing a problem with ascii file conversion
An ascii file created under UNIX cannot be viewded correctly under windows ( CR LF conversion ) is there an option with Ontap to convert ascii files when opening them under windows and vice-versa ?
Thanks a lot.
The filer does not do any data conversion that I am aware of.
In our experience we have found that folks who use both Windows and Unix do not often manipulate the same file on both systems. Usually Windows files are only manipulated from Windows and Unix files only from Unix.
However, we do recommend installing NoteTab Light on Windows and using that instead of standard Windows NotePad. NoteTab accepts all three text file line terminators: LF (unix) CRLF (dos) CR (Apple) and will generate output using any of these. So you can keep a file in its original format or convert it.
On the Unix side, Solaris has the "flip" command that converts a text file from LF to CRLF and vice versa. This utility may be available on other flavors of Unix, too.
If you don't have flip, here is a trivial awk command to convert unix to dos by adding CR to each line:
awk '{print $0 "\r"}' unixfile > dosfile
Here is a trivial sed command to convert dos to unix by stripping the CR at the end of the line.
sed 's/.$//' dosfile > unixfile
On Linux, vi (vim) detects the line terminator style and preserves it. And you can also force dos line terminators with the vi command
:set fileformat=dos or :set ff=dos
To force unix use
:set fileformat=unix or :set ff=unix
Steve Losen scl@virginia.edu phone: 434-924-0640
University of Virginia ITC Unix Support
On the UNIX side, you can also use the dos2unix and unix2dos commands.
That depends on the UNIX; Digital UNIX 4.0, for example, doesn't have those commands, unless they're in a component we didn't install:
hostname$ uname -sr OSF1 V4.0 hostname$ dos2unix ksh: dos2unix: not found hostname$ unix2dos ksh: unix2dos: not found
The same applies to HP-UX 11.00:
hostname$ uname -sr HP-UX B.11.00 hostname$ dos2unix ksh: dos2unix: not found hostname$ unix2dos ksh: unix2dos: not found
and, for that matter, to whatever version of Red Hat Linux is on some machines here:
hostname$ uname -sr Linux 2.2.14-6.1.1 hostname$ dos2unix ksh: dos2unix: not found hostname$ unix2dos ksh: unix2dos: not found
I would not, however, be surprised to hear that there's a GNU utility that'll convert between DOS/Windows and UNIX text file format.
On Wed, Jan 16, 2002 at 12:12:49PM -0800, Guy Harris wrote:
On the UNIX side, you can also use the dos2unix and unix2dos commands.
That depends on the UNIX; Digital UNIX 4.0, for example, doesn't have those commands, unless they're in a component we didn't install:
The same applies to HP-UX 11.00:
hostname$ uname -sr HP-UX B.11.00 hostname$ dos2unix ksh: dos2unix: not found hostname$ unix2dos ksh: unix2dos: not found
it's called ux2dos on HPUX
and, for that matter, to whatever version of Red Hat Linux is on some machines here:
hostname$ uname -sr Linux 2.2.14-6.1.1 hostname$ dos2unix ksh: dos2unix: not found hostname$ unix2dos ksh: unix2dos: not found
I would not, however, be surprised to hear that there's a GNU utility that'll convert between DOS/Windows and UNIX text file format.
Correct, there's an RPM called unix2dos which can be installed.
Igor