Bonjour,
Je rechercher dans un fichier ligne par ligne, le mot erreur.
Lorsque je trouve celui ci, j'affiche la ligne que je redirectionne dans ficerror.
Quand j'ouvre mon fichier log à analyser sous notepad, il s'affiche trés bien.
Mais lorsque je fais un print $ligne, j'apercois que mes caractéres s'affiche comme cela : i l e x i s t e u n e p r o b l e m e : e r r e u r.
alors que sous wordpad, s'affiche il existe un probleme : erreur
voici mon code !!!
my $Type="COMPLET";
my $FicLog="E:/LOG/20060710_Batch_IMPORT";
my $FicError="E:/TEMP/error_";
my @GestionErreur = ("erreur");
$FicError=$FicError . ${Type} ;
unlink $FicError ;
print "${FicLog}\n";
print "$FicError\n";
open (FIC, "<${FicLog}") || die "Ouverture impossible du fichier ${FicLog} : $!";
open (FICERREUR, ">$FicError") || die "Ouverture impossible du fichier $FicError : $!";
while ($Ligne = <FIC> )
{
if (grep { $Ligne =~ m/$_/g } @GestionErreur)
{
print FICERREUR "$Ligne" ;
}
print "$Ligne\n" ;
}
close (FIC);
close (FICERREUR);
#Test si le fichier Error est vide
if (-z $FicError)
{
$KOOK="OK";
print "Erreur Batch : ok\n" ;
}
else
{
$KOOK="KO";
print "Erreur Batch : KO\n" ;
}
Partager