#!/usr/bin/awk # BEGIN{j=1;attribut=0;nbValeur=0;} { if (data==1) { tab[j]=$0 #print tab[j] j++ } if ($1=="@data") { data=1 } if (vm==0) { chaine=substr($2,1,2) if (chaine!="Pr") { i=index($1,"#") if (i==1) { nbv[attribut]=nbValeur; attribut++ nbValeur=0} else {nbValeur++} } else {vm=1} } } END { nbv[attribut]=nbValeur-1 premierItem[1]=1 for (i=2; i<=attribut;i++) {premierItem[i]=nbv[i-1]+premierItem[i-1] } for (i=1; i<=attribut;i++) {print i " " nbv[i] " "premierItem[i]} print "@data" for(i=1;i<=j-1;i++) {print tab[i]} #print "Fin progrmme" }