#!/usr/bin/perl <; open(FIC1, ">$fic"); my $i=0; my $j=0; my $k=0; my @token=(); while () { my $ligne=$_; chomp $ligne; my @liste=split(/\t/,$ligne); push(@token, $liste[$i++]." "); push(@lemme, "$liste[$i++]" ." "); push(@patron, "$liste[$i++]" ." "); $i=0; } #on a 3 listes @token, @lemme, @patron @sous_patron=(); while (defined($element_patron=shift(@patron))) { $element_patron=~s/\n//; if ($element_patron !~ "PCTFORTE") { push(@sous_patron, $element_patron); $j++; next; } my @sous_token=@token[$k..$j-1]; &cherche_patron(@sous_patron); @sous_patron=(); $k=$j+1; #print "tape return pour continuer"; #my $reponse=; $j++; } #============================================= sub cherche_patron { my @liste=@_; my $suite_de_patrons=join("",@liste); $z=0; $nb=0; open(FIC, "$ARGV[1]"); while() { $nb=0; $ligne=$_; chomp $ligne; #print "voici le patron traité : $ligne\n"; while ($ligne=~m/ /g) {$nb++}; $nb++; while ($suite_de_patrons=~m/$ligne/g) { my $avant=substr ($suite_de_patrons, 0, pos($suite_de_patrons)-length($&)); while ($avant=~m/ /g) {$z++}; print FIC1 "@token[$k+$z..$k+$z+$nb-1]\n"; #print "tape sur return pour continuer\n"; #my $reponse=; $z=0; } } }