Question: 1. Write an awk script that will take the following data file process each record based on the keyword in the first field. You will

1. Write an awk script that will take the following data file process each record based on the keyword in the first field. You will start with 0 and then either add or subtract the numbers from it.

Input file (lab0401.csv)

Example output

ADD,1,3,5,8,10,11,54

SUB,1,2,3,4

ADD,15,18,21,42,37

ADD,1,1,1,0,0,3,16

ADD,4,1,8,0,4,6,13,16,17,20,8,6,4

SUB,13,8

92

-10

133

22

107

-21

2. Write an awk script to read the provided data file and output the number of lines with a value of onsite and online in the Section field. Separate the two output elements with a single space.

Input file (lab0402.csv)

Expected output of script

Name,Final Grade,Section

Andrew,95,online

Brandon,100,online

Chelsey,100,onsite

Deborah,72,online

Erik,65,online

Arielle,88,onsite

Shaun,91,onsite

Ninette,82,online

Nguyen,80,onsite

online 5

onsite 4

3. Write an awk script to read the provided data file and calculate the letter grade based on the value for the Final Grade field. Your logic should be based on the scale provided below. Output the Name and letter grade separated by a tab character.

Grade scale (inclusive)

  • A = 90 to 100

  • B = 80 to 89

  • C = 70 to 79

  • D = 60 to 69

  • E = 0 to 59

Input file (lab0402.csv)

Expected output of script

Name,Final Grade,Section

Andrew,95,online

Brandon,100,online

Chelsey,100,onsite

Deborah,72,online

Erik,65,online

Arielle,88,onsite

Shaun,91,onsite

Ninette,82,online

Nguyen,80,onsite

Andrew A

Brandon A

Chelsey A

Deborah C

Erik D

Arielle B

Shaun A

Ninette B

Nguyen B

NOTE: The columns in your output might not line up perfectly, this is okay. Ensure your name and calculated grade are separated by a single tab for full credit.

4. Using your Task 03 script, write an awk script to output the number of each letter grade. Write each letter A - E with the corresponding count, separated by a comma.

Input file (lab0402.csv)

Expected output of script

Name,Final Grade,Section

Andrew,95,online

Brandon,100,online

Chelsey,100,onsite

Deborah,72,online

Erik,65,online

Arielle,88,onsite

Shaun,91,onsite

Ninette,82,online

Nguyen,80,onsite

A,4

B,3

C,1

D,1

E,0

5. Write an awk script which reads the provided data file and outputs the highest and lowest grave, as well as the average and median grade for the online and onsite sections. Your output should be separated with a single space. Format floating point numbers to 2 decimal places.

Input file (lab0402.csv)

Expected output of script

Name,Final Grade,Section

Andrew,95,online

Brandon,100,online

Chelsey,100,onsite

Deborah,72,online

Erik,65,online

Arielle,88,onsite

Shaun,91,onsite

Ninette,82,online

Nguyen,80,onsite

Section Average

online 82.80

onsite 89.75

Highest grade: 100

Lowest grade: 65

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!