From owner-freebsd-questions Tue Aug 8 13:14:30 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail2.wmptl.com (mail2.wmptl.com [216.221.73.131]) by hub.freebsd.org (Postfix) with ESMTP id EB7E737B539 for ; Tue, 8 Aug 2000 13:14:26 -0700 (PDT) (envelope-from webmaster@wmptl.com) Received: from wmptl.com ([10.0.0.168]) by mail2.wmptl.com (8.9.3/8.9.3) with ESMTP id QAA64860 for ; Tue, 8 Aug 2000 16:12:57 -0400 (EDT) (envelope-from webmaster@wmptl.com) Message-ID: <399069B1.1AB04AFF@wmptl.com> Date: Tue, 08 Aug 2000 16:12:33 -0400 From: Nathan Vidican X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: questions@freebsd.org Subject: Windows ASCII files -> Unix ASCII Files Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Is there any sort of utility to rip the ^M characters from the end of each line in an ASCII text file as produced by Windows? I've tried using a simple regexp with perl, as well as using chop/chomp, but niether seem to work, any ideas? Here is what I tried to create: #!/usr/bin/perl if (! @ARGV[1]) { $outfile = @ARGV[0]; } else { $outfile = @ARGV[1]; } open(IN,@ARGV[0]); @lines = ; close(IN); open(OUT,">$outfile"); foreach $line (@lines) { chomp($line); print OUT "$line\n"; } #end of script As opposed to the above 'chomp($line)', I have also tried: $line =~ tr/^M//; chomp($line); and before the for-loop, 'chop(@lines);'. None of which have worked. I figure there has got to be some easy way of doing this? Right now we're FTP get/binary, then FTP put/ASCII 'ing in order to convert; which needless to say is a pain in the neck. Any ideas or suggestions would be helpful. -- Nathan Vidican webmaster@wmptl.com Windsor Match Plate & Tool Ltd. http://www.wmptl.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message