#!/usr/bin/awk # BEGIN{attribut=1;data=0;j=0; # je modifie la valeur de 1000 si NF va dépasser 1000 for (h=1;h<=1000;h++) {vm[h]=0} } { if ($1=="@data") {data=1 dernierItem=PremierItem[attribut-1]+nbv[attribut-1]-1 } if(data==0) { nbv[attribut]=$2 PremierItem[attribut]=$3 attribut++ } else {# je lis les transactions à partir de @data if($i!="@data") {k=1 while(k<=NF) {j=index($k,"-") if (j==1) {#item manq # printf $k " " # printf $k " " > "data_codif.txt" p=substr($k,2) a=retourner_attribut(p) #print "attribut de l'item " p "est " a v=retourner_nbv(a) #print "nbbghfgthfghn v " v if (vm[a]==0) { vm[a]=dernierItem+1 dernierItem++ # printf dernierItem " " printf dernierItem " " > "data_codif.txt" } else {#printf vm[a] " " printf vm[a] " " > "data_codif.txt" } k=k+v }#end if else { #item non manquant #printf $k " " printf $k " " > "data_codif.txt" k++ } j=0 }#end for #printf "\n" printf "\n" > "data_codif.txt" } } } END { #for (i=1; i "codif_Vms.txt" } } #print "Fin progrmme" } function retourner_attribut(item) { trouve=0 f=1 while(trouve==0 && f<=NF) { if(PremierItem[f]==item) {trouve=1} else {f++} } return f} function retourner_nbv(att) {return nbv[att] }