in reply to Re^2: Parse the text file output and delete files
in thread Parse the text file output and delete files

Hi,

the general basic idea might perhaps be something like this:

my $last_sql_file; while (my $line = <$LOG>) { chomp $line; $last_sql_file = $1 if $line =~ /^executing: \@(.+)/; if ($line =~ /^ERROR at/) { unlink $last_sql_file if -f $last_sql_file; # don't try to del +ete this file if it was already deleted on a previous error } }
That's the basic algorithm, please fell free to ask if you don't understand it. I leave it to you to find out in the documentation how to open the log file if you don't know how (clue: take a look at open).