Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2002 15:53:29 -0600 (CST)
From:      Lee J Carmichael <lcarmich@wamnet.com>
To:        Thomas von Hassel <thomas@vermoe.dk>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: tool/method to convert DOS line endings to UNIX line endings
Message-ID:  <Pine.SGI.3.96.1021203155019.243744X-100000@y.dev.wamnet.com>
In-Reply-To: <BF8710A0-0708-11D7-AFC7-0003936CEB72@vermoe.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
If you are going from DOS to Unix you could use the following perl script:

#!/usr/bin/perl -w

use strict;

my $pcfile = shift || "/tmp/dosfile.txt" ;
my $outfile = shift || "/tmp/unixconverted.txt";

die "Cannot read $pcfile..." unless -r $pcfile;

open(IN, "$pcfile") or die "Cannot open $pcfile: $!";
open(OUT, ">$outfile") or die "Cannot open $outfile: $!";

$/ = "\r"; ## pc end of line, damn gates

while(<IN>) {
   chomp;
   print OUT "\n";
}

## should really check the close of these but...
close(IN);
close(OUT);

exit;


--------
Lee Carmichael		
Service Architect - WorkSpace

WAM!NET Inc.
655 Lone Oak Rd Building A
Eagan, MN 55121

ph# 651-256-5292 
email: lcarmich@wamnet.com

On Tue, 3 Dec 2002, Thomas von Hassel wrote:

> 
> On Tuesday, December 3, 2002, at 10:11 PM, Jerry McAllister wrote:
> >
> >
> > If you are moving th efiles, use ftp in ASCII mode.  It will then
> > do the conversion for you.  After you make the ftp connection and
> > before GETting or PUTting the file, type ASCII to select ASCII mode.
> 
> that doesnt work, tried diferent ftp clients both getting and putting 
> the files ...
> 
> /thomas
> 
> 
> --
> Thomas von Hassel
> DarX @ irc
> darxmac @ AIM/iChat
> Powered by inkwell...!
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.3.96.1021203155019.243744X-100000>