CIS 18B ASSIGNMENT 3

awk


Use awk for all problems in this assignment. Save the results in an output file.

For each exercise, turn in an awk script, the command line invocation of awk, and the resulting output.


Use the following test data when you execute your commands to produce the result you turn in. However, do not assume this is all the data that your commands must process. Assume that other similar data must also be processed correctly.


Each data record has the same 4 fields.

A tab is used as the field separator.

The end of the line is used as a record separator. The four fields are:


field 1: first-name

field 2: last-name

field 3: salary-rate

field 4: hours-worked


Input file


George White 4.00 23

Mark Red 4.25 11

Mary Blue 3.89 13

Dan Black 5.23 0

Susan Green 5.01 4

Nora Brown 4.95 5

Bruce Purple 5.95 7

John Gray 4.89 0

Bob Gold 6.22 30

Steve Silver 4.45 23


Exercise 1

Print the full name of each employee who has the letter u in their first name.


Exercise 2

Print a heading: First Last Pay

Print the first name, last name, and the week's pay for each employee.

The weeks pay is computed by multiplying the salary-rate and the hours-worked.


Exercise 3

Print the total pay of all employees, print the total hours worked by all employees, and print the overall average pay per hour. Provide suitable text to accompany these numbers.