Lonewolf wrote: > > Thanks for everyone's help with this one, I was stuck and knew I was missing > something simple.. UGH. perldoc -q replace didn't turn me up with anything > either, which was a bummer, but going off the code posted here I was able to > do more with it. > > This is what I used: > ---------------------------- > 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 = $line =~ /^\s*(.*)\s*\n$/; > $line =~ s/\s+/ /g; > $line =~ s/^ //; > $line =~ s/ $//; > $line =~ s/\t/|/g; ^^ You won't have any TAB characters in $line because the \s+ three lines up has removed them all.
> print NEWFILE "$line\n"; > } > close OLDFILE; > close NEWFILE; > } > } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]