1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
nawk '
function return_lettres(chaine,index)
{
longueur=length(chaine);
if ( (longueur - index) <= 1 )
{
return chaine;
}
carac1=substr(chaine,index,1);
carac2=substr(chaine,index+1,1);
debut_chaine=substr(chaine,0,index);
fin_chaine=substr(chaine,index+2,longueur-(index+2));
chaine_reconstitue=debut_chaine carac2 carac1 fin_chaine;
return return_lettres(chaine_reconstitue,index+2);
}
BEGIN{
debut_montant=334;
longueur_montant=18;
debut_libelle=364;
longueur_libelle=20;
}
{
debut=substr($0,0,debut_montant);
milieu=substr($0,debut_montant+longueur_montant,debut_libelle);
fin=substr($0,debut_libelle+longueur_libelle,length($0));
montant=substr($0,debut_montant,longueur_montant);
libelle=substr($0,debut_libelle,longueur_libelle);
nouveau_libelle=return_lettres(libelle);
montant=montant*1.3;
printf("%s%s%s%s%s",debut,montant,milieu,nouveau_libelle,fin);
} ' ${in_fic} >> $out_fic |
Partager