Bonjour,
Je deviens chèvre pourquoi ma variable est prise en compte quand elle s'appelle T et devient vide quand elle s'appelle Tbits
Le fichier
phil@phil-G750JH:~/Documents/JeCodeShell/ApprendreAWK$ cat student
Jones 2143 78 84 77
Gondrol 2321 56 58 45
RinRao 2122 38 37
Edwin 2537 87 97 95
Dayan 2415 30 47
Le code avec variable Tbits
#!/bin/bash
awk 'BEGIN { print " Debut "; }
{
TBits=$3;
# printf "Tbits=" TBits "\n";
if ( Tbits >= 70 ) {
Affiche=($3*1048576);
}
else {
Affiche=$3;
print "Tbits="Tbits
}
print "Resultat Affiche =",Affiche,"\n";
}' "student"
Mon resultat incompris :
phil@phil-G750JH:~/Documents/JeCodeShell/ApprendreAWK$ ./sgrade.awk
Debut
Tbits=
Resultat Affiche = 78
Tbits=
Resultat Affiche = 56
Tbits=
Resultat Affiche = 38
Tbits=
Resultat Affiche = 87
Tbits=
Resultat Affiche = 30
phil@phil-G750JH:~/Documents/JeCodeShell/ApprendreAWK$
LE code avec variable T
#!/bin/bash
awk 'BEGIN { print " Debut "; }
{
T=$3;
# printf "Tbits=" TBits "\n";
if ( T >= 70 ) {
Affiche=($3*1048576);
}
else {
Affiche=$3;
print "T="T
}
print "Resultat Affiche =",Affiche,"\n";
}' "student"
LE resultat qui fonctionne cette fois
phil@phil-G750JH:~/Documents/JeCodeShell/ApprendreAWK$ ./s2grade.awk
Debut
Resultat Affiche = 81788928
T=56
Resultat Affiche = 56
T=38
Resultat Affiche = 38
Resultat Affiche = 91226112
T=30
Resultat Affiche = 30
phil@phil-G750JH:~/Documents/JeCodeShell/ApprendreAWK$
Merci de votre aide
Désolé je n'avais pas vu tous simplement une lettre en majuscule qu était en minuscule.