hi Ron, another unix command is flip.
i've written a small perl script that converts a dos file to a unix one. as you can see, i've just substituted the \r\n with a \n. the reverse can easily be done. this is a working example. it's not fast, but workable. i'd welcome any suggestions. hth, -tir #!/usr/bin/perl -w use strict; use POSIX; # Convert a file from a DOS to a UNIX format. sub help { printf "Converts a DOS formatted file to UNIX format. Useful for converting data from Prowess, or any other Windows database, for use in UNIX software, like SAS. Instructions: Do chmod 500 $0 Restrictions: No binary files, no file above 50 MB. Usage: $0 filename\n"; exit 1; } &help if ($#ARGV == -1); my($TMPFILE) = "/tmp/AAAAZZZZEEEE"; my(@Files) = @ARGV; my(@R); foreach (@Files){ my($File) = $_; if ( -B $File){ printf "$File is a binary file. Could get damaged. Not processed.\n"; next; } open(TMP,">$TMPFILE") || die "could not open TMPFILE: $!"; open(IN,"$File") || die "could not open $File: $!"; while(<IN>){ my($line) = $_; $line =~ s/\r\n$/\n/; print TMP $line; } close(IN); close(TMP); system ("mv $TMPFILE $File"); printf STDERR "$File done.\n"; } exit; On Thu, 25 Apr 2002, Ron Powell wrote: > There is a utility out there that will convert unix-style end-of-lines (LF) > to dos-style (CR/LF)... > > Just for giggles, I'm trying to write a perl script to do this... > > Here's what I've tried... > > while (<INFILE>) { > $line = $_; > $line=~tr/\012/\015\012/; > print OUTFILE ("$line\n"); > } > > The problem is that the output, when viewed with notepad, contains > inappropriate line breaks... > > The same input file, when converted using the unix utility unix2dos, > converts "properly." This leads me to believe that I'm missing something > obvious here.... > > I'm not asking for the answer per se, but perhaps a pointer? > > ---------- > Ron Powell > Senior IT Analyst & > Network Administrator > gomembers, Inc. (Baltimore Office) > [EMAIL PROTECTED] > 410-494-1600 x4058 > <<...OLE_Obj...>> > > > -- Tirthankar, IGIDR. +91-22-8400919 x275 (r), x593(o), x542(CFL). http://www.igidr.ac.in/~tir ACADEME, n. An ancient school where morality and philosophy were taught. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]