« Utilisateur:Kipmaster/demander-format.pl » : différence entre les versions

Contenu supprimé Contenu ajouté
Création : <pre> #!/usr/bin/perl $intext = 0 ; $titlebien = 0 ; open(LISTEFREQ, "</tmp/liens-compte"); # open for input my(@listefreq) = <LISTEFREQ>; # read file into list $index = 0 ;...
 
(Aucune différence)

Dernière version du 7 juillet 2008 à 20:05

#!/usr/bin/perl


$intext = 0 ;
$titlebien = 0 ;

open(LISTEFREQ, "</tmp/liens-compte"); # open for input
my(@listefreq) = <LISTEFREQ>;         # read file into list


$index = 0 ; # la première ligne (0) casse tout
$motetfreq = $listefreq[$index] ;
if (  $motetfreq =~ / *(\d+) (.*)/ ) {
  $freq = $1 ;
  $mot_ref = "$2\n" ;
}

while (<>) {
  $ligne = $_ ;

# print "mot1 : $ligne mot2 : $mot_ref" ;
  while ( $mot_ref lt $ligne ) {
    $index++ ;
    $motetfreq = $listefreq[$index] ;
    if (  $motetfreq =~ / *(\d+) (.*)$/ ) {
      $freq = $1 ;
      $mot_ref = "$2\n" ;
    }
  }

#  $frequence = `fgrep -c "$ligne" /home/cmillet/wikitruks/xml/work/liens` ;
#  chop( $frequence) ;
  chop ($ligne) ;
  print "$freq [[$ligne]]\n" ;
}

close(LISTEFREQ);