Below is script where it edits the file, removes txt extension and writes new file.
I also need to insert timestamp into filname (fileA2007-03-25 12:01:12 ; fileB2007-03-26 10:50:55). How can I achieve that? Help needed.
I also need to insert timestamp into filname (fileA2007-03-25 12:01:12 ; fileB2007-03-26 10:50:55). How can I achieve that? Help needed.
Code:
$failid="list.ao";
$fail=0;
if (open(FAILIDcnt, $failid)) {
while($line = <FAILIDcnt>) {
chomp($line);
$pnt[$fail]=($line);
#print "$line\n";
$fail ++;
}
close (FAILIDcnt);
}
$failm=0;
do {
too( $pnt[$failm]);
$failm ++;
} until $failm>$fail;
sub too {
my @sisse = @_;
my $fff=$sisse[0];
if (open(IF, $fff)) {
$fff=~ s/\.txt//;
open(OF,">".$fff) or die "Can't open $fff!";
while($line = <IF>) {
if ($line =~ /^(-------------------)/) {
close (OF);
close (IF);
return 0;}
$line =~ s/\t/;/g;
print OF "$line";
}
}
}