Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use awk to process some CSV (comma separated values) data in a text file. - Crea

ID: 3799658 • Letter: U

Question

Use awk to process some CSV (comma separated values) data in a text file.
- Create an awk script something.awk to contain your code
- Print with columns
- Hint: add the scores together to get answer from the image below.

Eksc rivno rdlocalhost labo5]$ cat q4.txt Name, Lab, Midterm,Final jhowlett ,72,81,75 ksc rivno r,10G ,10G, 10G jwick,87,95,90 ksc rivno rdlocalhost labG5 /a4. awk q4.txt Name Lab Midterm Final 75 jhowlett 72 81 100 kscrivnor 10 100 90 jwick 87 95 Grade Name kscrivnor 100% jwick 90.6667% 76% jhowlett Oksc rivnor@localhost labo5]$ i

Explanation / Answer

Average.awk

# Begin
BEGIN {
FS=" ";
}

# Dev
{
name[NR] = $1;
average[NR] = ($2 + $3 + $4) / 3;
}

# End
END {
i = 1;
while (i <= FNR) {
   printf("%-10s %.2f ", name[i] , average[i++]);
}
}

note: execute like