John, thanks for the heads-up, I saw the errors and modified the lines.

For anyone wanting to do this on their own system...
--------------------------------------------
sub cleanup{

use strict;

my $dirname = "/home/data";
my $file;
my $newfile;
my $line;

opendir (DIR, $dirname) or die "Can't opendir $dirname: $!"; while
(defined($file = readdir(DIR))) {
        next if $file =~ /^\.\.?$/;
        open (OLDFILE, "< $file");
        $newfile = $file . "_nice";
        open (NEWFILE, "> $newfile");
        while ($line = <OLDFILE>)  {
                $line =~ s/^ //;
                $line =~ s/ $//;
                $line =~ s/\t/|/g;
                $line =~ s/\s+/ /g;
                print NEWFILE "$line\n";
        }
        close OLDFILE;
        close NEWFILE;
  }
}
--------------------------------------------


Robert

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to