Question: Hello, I am working with .awk files in the Ubuntu linux command line. I thought I answered the questions correctly, but my teacher said I
Hello, I am working with .awk files in the Ubuntu linux command line. I thought I answered the questions correctly, but my teacher said I should not submit the commands, she wants to see the scripts. So this answer "cat hw0409.csv | tail -n+2 | awk -F',' 'BEGIN{sum=0;count=0;}{sum+=$3;count+=1;}END{print "AVG: "sum/count;}" is not appropriate.
Therefore, could you please help me write the script beginning with this format (Ive done my other codes using this format):
#!/usr/bin/awk
BEGIN {
FS= ","
HERE IS THE QUESTION:
Write an awk script that will output the average of all the sales figures.
Input file (hw0409.csv):
Name,Emp ID,Sales,Dept,Resi
Andrew,24,88,Eng,Y
Brandon,66,14,Mkt,Y
Chelsey,8,,Eng,N
Deborah,38,,Ift,Y
Erik,32,13,Mkt,N
Arielle,13,48,Eng,N
Shaun,55,78,Ift,N
Ninette,3,24,Opr,Y
Nguyen,10,54,Eng,Y
Example output:
AVG: 35.4444
I tried doing this question, but I kept getting 0 as the average, so I'd really appreciate your help.

[Here is a screenshot of the same question]
Thanks!!
Write an awk script that will output the average of all the sales figures. Input file (hw0409.csv) Example output AVG: 35.4444 Name , Emp ID, Sales, Dept, Resi Andrew, 24,88, Eng, Y Brandon, 66,14, Mkt, Y Chelsey, 8, , Eng, N Deborah, 38, ,Ift, Y Erik, 32,13, Mkt,N Arielle, 13,48, Eng,N Shaun, 55, 78,Ift,N Ninette, 3, 24, Opr, Y Nguyen, 10,54, Eng, Y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
