[PERL]- traduire du shell en perl

Fermé
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 - 9 avril 2008 à 13:39
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 - 22 avril 2008 à 15:29
Bonjour,

Avis aux habitués!!
je suis en train de me mordre les doigts sur une traduction d'un programme en perl:

cat $Conf_file | while read line
do
cat $File.sort | grep -v -w "$line" > $File.tmp
cat $File.tmp > $File.sort
done
cat $File.sort | sort >> $File.focal

Merci de tout coeur!!!
A voir également:

90 réponses

tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
10 avril 2008 à 15:25
par exemple:

fichier.analyse
vmonitor ntpd: kernel time sync status 0040
vmonitor ntpd: synchronized to LOCAL(0), stratum 10
vmonitor ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 E
DT 2006 (1)
vmonitor ntpd: precision = 18.000 usec
vmonitor ntpd: Listening on interface wildcard, 0.0.0.0#1
23
vmonitor patate: chou

fichier.conf
vmonitor ntpd: kernel time
vmonitor ntpd: synchronized to
vmonitor ntpd: ntpd 4.2.0a@1.1190-r
vmonitor ntpd: precision =
vmonitor ntpd: Listening on

Alors en fait je veux lire chaque ligne de mon fichier.analyse et si elle ne correspond ou ressemble de près a aucune ligne de mon fichier.conf je la met dans un fichier .tmp.
Ensuite je test la ligne suivante de .analyse et jusqqu'à la fin du fichier.

ici fichier.tmp
vmonitor patate: chou

Dès avoir fini de tester toutes les lignes de mon .analyse je remet tout le fichier .tmp dans .analyse en ecrasant le reste:

fichier.analyse
vmonitor patate: chou

après avoir fini je trie dans l'ordre alpha le fichier .analyse (ici il n'y a rien a faire) et je met tout cela a la suite du fichier.focal

Voila!!
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
10 avril 2008 à 21:11
alors personne sait??
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
10 avril 2008 à 21:29
Salut,

en fait tu compliques les choses

dans ce cas vu que les lignes du fichier.conf peuvent répresenté une partie des lignes du fichiers analyse, le problème doit être poser à l'invers

pour chaque ligne de fichier.conf s'il correspond a une ligne de fichier analyse......
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
10 avril 2008 à 21:47
oui enfin sa reste dans le meme ordre idée.
tu voi ce ke je veux dire koi!!!! ;)
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
10 avril 2008 à 21:54
Et voici tes patates ;-)
lami20j@debian:~/trash$ cat compfic.pl
#!/usr/bin/perl
use strict;use warnings;

open CONF,"fichier.conf"
   or die "E/S : $!\n";
open ANALYSE,"fichier.analyse"
   or die "E/S : $!\n";
open TMP,">fichier.tmp"
   or die "E/S : $!\n";

my @conf=<CONF>;
chomp @conf;
while(my $e=<ANALYSE>){
        chomp($e);
        print TMP $e,"\n" unless grep { $e=~/$_/ } @conf;
}
__END__

lami20j@debian:~/trash$ cat fichier.analyse
vmonitor ntpd: kernel time sync status 0040
vmonitor ntpd: synchronized to LOCAL(0), stratum 10
vmonitor ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
vmonitor ntpd: precision = 18.000 usec
vmonitor ntpd: Listening on interface wildcard, 0.0.0.0#123
vmonitor patate: chou
lami20j@debian:~/trash$ cat fichier.conf
vmonitor ntpd: kernel time
vmonitor ntpd: synchronized to
vmonitor ntpd: ntpd 4.2.0a@1.1190-r
vmonitor ntpd: precision =
vmonitor ntpd: Listening on
lami20j@debian:~/trash$ perl compfic.pl
lami20j@debian:~/trash$ cat fichier.tmp
vmonitor patate: chou
lami20j@debian:~/trash$
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
10 avril 2008 à 21:58
alala merci!!!
si ca marche je te nomme dans mon rapport de stage!!!!! :))
je vais tester cela demain au boulot avec imatience pour voir si tout se passe bien!!
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
10 avril 2008 à 21:59
tu me tiendras au courant si ça marche ou pas ;-)
bonne soirée
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
10 avril 2008 à 22:00
bonne soirée a toi ossi!!
pas de folie!!!! hihi
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 09:31
alors je viens de tester ton script lami20j mais cela ne passe pas lorsque j'execute le script. j ai donc essayé le script suivant qui passe a l execution mais cette fois ci cela tronque mon fichier.analyse. par la je veux dire qu'il possède 280-350 lignes en moyenne et plus il augmente (car c'est un fichier log) et plus les lignes du debut sont tronquées. Si je ne le met pas dans cette focntion, mon .analyse n'est pas tronqué alors que lorsqu'il rentre dans cette fonction il est tronqué. Je ne voit pas d'ou cela peut venir. Dès lors vu qu'il est tronqué le test par le fichier .conf est imposible!!!

Voici ma fonction:

open (my $fh_conf, $conf_file) or die("impossible d'ouvrir le fichier $fichier_conf, $!\n");
	close($fh_conf);
	my @data_temp;
	my @conf_file= <$fh_conf>;
	 
	# Lecture fichier analyse
	open (my $fh_analyse, $file_analyse) or die("impossible d'ouvrir le fichier $fichier_analyse, $!\n");
	while(my $ligne_analyse = <$fh_analyse>) {
	  chomp($ligne_analyse);
	  my $compt = 0;
	  # Lecture fichier conf
	  foreach my $ligne_conf (@conf_file) {
	    chomp($ligne_conf);
	    # comparaison
	    if($ligne_analyse =~ /$ligne_conf/i ) {
	      $compt ++;
	      last;
	    }
	  }
	  if($compt == 0) {
	    push (@data_temp, $ligne_analyse);
	  }
	}
	close($fh_analyse);
	 
	open (my $fh_focal, ">>$file_focal") or die("impossible d'ecrire dans le fichier $fichier_focal, $!\n");
	open (my $fh_analyse2, ">$file_analyse") or die("impossible d'ecrire dans le fichier $fichier_analyse, $!\n");
	foreach my $temp (sort @data_temp) {
	  print {$fh_focal} "$temp\n";
	  print {$fh_analyse2} "$temp\n";
	}
	close($fh_focal);
	close($fh_analyse2);

  	$keep_length=(&nbLignes ($file_analyse));
   	unlink ($file_tmp);


0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
11 avril 2008 à 09:57
Alors peut être que c'est à cause de modificateur /i que ça ne marche pas le code que je t'ai donné
#!/usr/bin/perl
use strict;use warnings;

open CONF,"fichier.conf"
   or die "E/S : $!\n";
open ANALYSE,"fichier.analyse"
   or die "E/S : $!\n";
open TMP,">fichier.tmp"
   or die "E/S : $!\n";

my @conf=<CONF>;
chomp @conf;
while(my $e=<ANALYSE>){
        chomp($e);
        print TMP $e,"\n" unless grep { $e=~/$_/i } @conf;
}
__END__
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 10:11
meme avec ton script le soucis est le meme:

code:
open CONF,"$conf_file" or die "E/S : $!\n";
	open ANALYSE,"$file_analyse" or die "E/S : $!\n";
	open TMP,">$file_tmp" or die "E/S : $!\n";

	my @conf=<CONF>;
	chomp @conf;
	while(my $e=<ANALYSE>){
        chomp($e);
        print TMP $e,"\n" unless grep { $e=~/$_/i } @conf;
	
	
		open (my $fh_analyse1, ">$file_analyse") or die("impossible d'ecrire dans le fichier $file_focal, $!\n");
		open (my $fh_tmp, "$file_tmp") or die("impossible d'ecrire dans le fichier $file_analyse, $!\n");
		while(my $temp= <$fh_tmp>) {
	 	 	print {$fh_analyse1} "$temp\n";
		}
		close($fh_analyse1);
		close($fh_tmp);
	}

	open (my $fh_focal, ">$file_focal") or die("impossible d'ecrire dans le fichier $file_focal, $!\n");
	open (my $fh_analyse2, ">$file_analyse") or die("impossible d'ecrire dans le fichier $file_analyse, $!\n");
	while( my $analyse=<$fh_analyse2>) {
	  print {$fh_focal} "$analyse\n";

	}
	close($fh_focal);
	close($fh_analyse2);
  	$keep_length=(&nbLignes ($file_analyse));
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 10:13
pourquoi cela tronquerai mon fichier.analyse?
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
11 avril 2008 à 10:22
ne t'eparpilles pas avec trop de code

teste seulement le code que je t'ai donné et vérifie le résultat
sinon, tu ne t'en sortira pas

n'oublie pas que je n'ai pas les même conditions de test que toi
si je n'ai pas le fichiers, la seule chose que je peux te donner ce sont les tests limités
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 10:34
j suis en train de tester sur ton code.
cela me renvoi bien les bonne valeurs dans tmp DU TANT qu'aucune ligne n'est tronquée dans le .analyse sinon cela me renvoi n importe quoi!
par contre dans ton script il me manque de après avoir trié de concaténer le .TMP après l'avoir rangé dans l'ordre (sort) dans mon .focal.

En bref:
my @conf=<CONF>;
	chomp @conf;
	while(my $e=<ANALYSE>){
        chomp($e);
        print TMP $e,"\n" unless grep { $e=~/$_/i } @conf;       

	}
       CONCATENER .TMP APR7S AVOIR FAIT UN PTIT SORT DANS MON .FOCAL
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 10:38
Je ne vais pas te mettre mon .analyse en entier car il fait 285 lignes.
C'est bizarre quand meme que cela le tronque seulement s'il rentre dans ce script

Bon alé .analyse:

PATATE: choux
CAROTTE: endive
TOMATE: endive
TOMATE: endive
TOMATO: endive
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: precision = 18.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 19.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: Listening on interface wildcard, 0.0.0.0#123
ntpd: Listening on interface wildcard, ::#123
ntpd: Listening on interface wildcard, 0.0.0.0#123
ntpd: Listening on interface wildcard, ::#123
ntpd: Listening on interface wildcard, 0.0.0.0#123

.conf
vmonitor ntpd: kernel time
vmonitor ntpd: synchronized to
vmonitor ntpd: ntpd 4.2.0a@1.1190-r
vmonitor ntpd: precision =
vmonitor ntpd: Listening on

a la fin je devrait n'avoir que mes 5 premières lignes de 'légumes' :)
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
11 avril 2008 à 11:30
Alors tu as vraiment un problème

dit moi comment tu veux comparer ces 2 lignes


fichier.analyse
ntpd: precision = 18.000 usec

fichier .conf
vmonitor ntpd: precision =

Quelque soit la comparaision les lignes sont toujours différentes

Donc tu dois bien spécifier un critère de comparaison
par exemple la chaine entre le 5 et le 10 caractère
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 13:25
pour le .conf j ai mal recopié car il n'y a pas le vmonitor a chaque foi!!

.conf
ntpd: kernel time
ntpd: synchronized to
ntpd: ntpd 4.2.0a@1.1190-r
ntpd: precision =
ntpd: Listening on

comme sa cela marche. le trie marche sauf de temps en temps où selon le nb de ligne de mon fichier .analyse, ce dernier est tronqué
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
11 avril 2008 à 13:28
car il n'y a pas le vmonitor a chaque foi!!


justement, il ne doit pas être du tout

comme sa cela marche. le trie marche sauf de temps en temps où selon le nb de ligne de mon fichier .analyse, ce dernier est tronqué
je t'ai déjà dit qu'on ne fait pas les tests sur les même fichiers ;-)

tu peux m'envoyer par mail les fichiers, pour que je teste chez moi
merci
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 15:05
Pour mon fichier .conf; S'il contient par exemple quelque chose comme:
Server Administrator: Instrumentation Service | Server Administrator starting ,
le test ne s'effectue pas sur les chaines de caractère contenant comme ici Expression 1 Quelque chose Expression 2 d'ou ici le "|".

Plus général. Fichier.conf
Expression1
Expression2 (ton caractère qui remplace le n'importe-quoi) Expression3

Puis ensuite on essaye de filter
(n'importe-quoi) Expression1
Expression1 (n'importe-quoi)
Expression1
Expression2
Expression2 (n'importe-quoi) Expression3
Expression2 (n'importe-quoi) Expression4
Expression3
Expression4


Ce qui est souligné ne devrait pas resortir alors que les autres oui et ici mon filtre enleve tout

exemple de mon fichierconf:
dhcpd: closing
dhcpd: exiting
dhcpd: Listening on
dhcps: pool
dhcpd: failover peer
dhcpd: locking dhcpd
proftpd| FTP no transfert timeout, disconnected.
proftpd| FTP session closed
proftpd| FTP session opened.
rdistd| startup for bravo
rdist:| shell returned 512
rexecd| connect from
rexecd| login from
Server Administrator: Instrumentation Service| Server Administrator starting
Server Administrator: Instrumentation Service| Server Administrator startup comp
lete
Server Administrator: Storage Service| Battery charge complete
Server Administrator: Storage Service| Battery is discharging
Server Administrator: Storage Service| Battery relearn will start in
Server Administrator: Storage Service| Battery started charging
Server Administrator: Storage Service| Patrol Read complete
Server Administrator: Storage Service| Patrol Read started
Server Administrator: Storage Service| The battery charge cycle is complete
Server Administrator: Storage Service| The controller battery is charging
Server Administrator: Storage Service| The controller battery Learn cycle has co
mpleted
Server Administrator: Storage Service| The controller battery Learn cycle has st
arted
Server Administrator: Storage Service| The controller battery Learn cycle will s
tart in
Server Administrator: Storage Service| The Patrol Read has started
Server Administrator: Storage Service| The Patrol Read has stopped
Server Administrator: Storage Service| Time established as
smbd:| *call_nt_transact_ioctl*
smbd:| *Connection reset by peer*
snmpd:| accepted
0
tonixm Messages postés 127 Date d'inscription mercredi 9 avril 2008 Statut Membre Dernière intervention 30 janvier 2009 4
11 avril 2008 à 15:06
exemple de fichier .analyse:

dhcpd: exiting
dhcpd: closing
dhcpd: allo
dhcpd: coucou
dhcpd: Listening on
dhcpd: locking dhcpd
dhcpd: pool
dhcpd: voiture
dhcpd: clio
dhcpd: punto
dhcpd: failover peeeeeeer
TEST: test
dhcpd: test
pooopp: test
Server Administrator: Storage Service EventID: 2242 The Patrol Read has started
.: Controller 0 (PERC 6/i Integrated)
Server Administrator: Storage Service EventID: 2243 The Patrol Read has stopped
.: Controller 0 (PERC 6/i Integrated)
Server Administrator: Storage Service EventID: 2095 SCSI sense data Sense key:
4 Sense code: 0 Sense qualifier: 81: Physical Disk 0:17 Controller 0, Connect
or 0
Server Administrator: Instrumentation Service EventID: 1000 Server Administrato
r starting
Server Administrator: Instrumentation Service EventID: 1012 IPMI status Interf
ace: OS
Server Administrator: Instrumentation Service EventID: 1001 Server Administrato
r startup complete
Server Administrator: Storage Service EventID: 2057 Virtual disk degraded: Vir
tual Disk 1 (Virtual Disk 1) Controller 0 (PERC 6/i Integrated)
Server Administrator: Storage Service EventID: 2095 SCSI sense data Sense key:
5 Sense code: 24 Sense qualifier: 0: Enclosure 0:0 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2052 Physical disk inserted: Ph
ysical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2121 Device returned to normal:
Physical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2050 Physical disk offline: Phy
sical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2065 Physical disk Rebuild start
ed: Physical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2121 Device returned to normal:
Physical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2095 SCSI sense data Sense key:
5 Sense code: 24 Sense qualifier: 0: Enclosure 0:0 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2092 Physical disk Rebuild compl
eted: Physical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2121 Device returned to normal:
Virtual Disk 1 (Virtual Disk 1) Controller 0 (PERC 6/i Integrated)
Server Administrator: Storage Service EventID: 2124 Redundancy normal: Virtual
Disk 1 (Virtual Disk 1) Controller 0 (PERC 6/i Integrated)
Server Administrator: Storage Service EventID: 2158 Physical disk online: Phys
ical Disk 0:0:3 Controller 0, Connector 0
Server Administrator: Storage Service EventID: 2242 The Patrol Read has started
.: Controller 1 (PERC 5/i Integrated)
Server Administrator: Storage Service EventID: 2243 The Patrol Read has stopped
.: Controller 1 (PERC 5/i Integrated)
Server Administrator: Instrumentation Service EventID: 1000 Server Administrato
r starting
Server Administrator: Instrumentation Service EventID: 1204 Current sensor dete
cted a failure value Sensor location: System Board System Level Chassis locati
on: Main System Chassis Previous state was: Unknown Current sensor value (in A
mps): 0.000
Server Administrator: Instrumentation Service EventID: 1012 IPMI status Interf
ace: OS
Server Administrator: Instrumentation Service EventID: 1001 Server Administrato
r startup complete
Server Administrator: Storage Service EventID: 2314 The initialization sequence
of SAS components failed during system startup. SAS management and monitoring i
s not possible.
Server Administrator: Instrumentation Service EventID: 1403 Memory device statu
s is non-critical Memory device location: DIMM1 Possible memory module event
cause:Single bit warning error rate exceeded
Server Administrator: Instrumentation Service EventID: 1000 Server Administrato
r starting
Server Administrator: Instrumentation Service EventID: 1204 Current sensor dete
cted a failure value Sensor location: System Board System Level Chassis locati
on: Main System Chassis Previous state was: Unknown Current sensor value (in A
mps): 0.000
Server Administrator: Instrumentation Service EventID: 1012 IPMI status Interf
ace: OS
Server Administrator: Instrumentation Service EventID: 1001 Server Administrato
r startup complete
Server Administrator: Storage Service EventID: 2314 The initialization sequence
of SAS components failed during system startup. SAS management and monitoring i
s not possible.
Server Administrator: Storage Service EventID: 2181 The controller battery Lear
n cycle will start in 24 hours.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2242 The Patrol Read has started
.: Controller 0 (PERC 5/i Integrated)
Server Administrator: Storage Service EventID: 2242 The Patrol Read has started
.: Controller 1 (PERC 5/E Adapter)
Server Administrator: Storage Service EventID: 2243 The Patrol Read has stopped
.: Controller 0 (PERC 5/i Integrated)
Server Administrator: Storage Service EventID: 2180 The controller battery Lear
n cycle will start in 2 days.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2243 The Patrol Read has stopped
.: Controller 1 (PERC 5/E Adapter)
Server Administrator: Storage Service EventID: 2180 The controller battery Lear
n cycle will start in 4 days.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2181 The controller battery Lear
n cycle will start in 5 hours.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2176 The controller battery Lear
n cycle has started.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2266 Controller log file entry:
Battery is discharging: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2248 The controller battery is e
xecuting a Learn cycle.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2188 The controller write policy
has been changed to Write Through.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2199 The virtual disk cache poli
cy has changed.: Virtual Disk 0 (MD1000) Controller 1 (PERC 5/E Adapter)
Server Administrator: Storage Service EventID: 2177 The controller battery Lear
n cycle has completed.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2247 The controller battery is c
harging.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2278 The controller battery char
ge level is below a normal threshold.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2279 The controller battery char
ge level is above a normal threshold.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2189 The controller write policy
has been changed to Write Back.: Battery 0 Controller 1
Server Administrator: Storage Service EventID: 2199 The virtual disk cache poli
cy has changed.: Virtual Disk 0 (MD1000) Controller 1 (PERC 5/E Adapter)
Server Administrator: Storage Service EventID: 2358 The battery charge cycle is
complete.: Battery 0 Controller 1
Server Administrator: Server Administrator: Instrumentation Service EventID: 140
4 Memory device status is critical Memory device location: DIMM1 Possible me
mory module event cause:Single bit warning error rate exceeded,Single bit failur
e error rate exceeded
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
ntpd: ntpd 4.2.0a@1.1190-r Thu Oct 5 04:11:32 EDT 2006 (1)
dhcpd: must restart dhcpd bientot
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
ntpd: Listening on interface eth0, 172.16.15.39#123
Apr 11 14:20:41 vmonitor last message repeated 4 times
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: Listening on interface lo, 127.0.0.1#123
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: kernel time sync status 0040
ntpd: precision = 17.000 usec
ntpd: precision = 18.000 usec
ntpd: precision = 18.000 usec
ntpd: Listening on interface wildcard, 0.0.0.0#123
ntpd: Listening on interface wildcard, ::#123
ntpd: Listening on interface wildcard, 0.0.0.0#123
ntpd: Listening on interface wildcard, ::#123
ntpd: Listening on interface wildcard, 0.0.0.0#123
ntpd: Listening on interface wildcard, ::#123
0