Question: CS3423 Project 3: Using Awk This project has two parts. Part A. You have been provided an unsorted file of names (/usr/local/courses/clark/cs3423/2017Fa/Proj3/unsortedNames.txt). Each name ends
CS3423 Project 3: Using Awk
This project has two parts.
Part A. You have been provided an unsorted file of names (/usr/local/courses/clark/cs3423/2017Fa/Proj3/unsortedNames.txt). Each name ends with a last name and may have multiple names and/or initials before the last name (unfortunately it varies). Use awk and sort to create a file sorted by last name. This may involve multiple awk and one sort step. The resulting sorted file should look similar to the original file except that it is sorted by last name.
Hint: Since the number of words in a name varies, we need to create an intermediate that has the last name first to simplify sorting. After sorting, we no longer want that last name as the first value.
Create a bash file named p3a.bash to create the sorted file. Besides the shebang line, there should be only one other line in the bash file. That line must use pipes between the steps.
Part B. You have been provided a customer reservation transactions file (/usr/local/courses/clark/cs3423/2017Fa/Proj3/reservation.txt). It contains three types of records:
CUST RESERVE
CUST M 1957/02/02 pcorn@abc.net Pop Corn RESERVE H222.15005 10 170.00 RESERVE H333.15010 5 200.00 ENDCUST
For part B, you must produce the following output: 1. Print a table heading showing "Name", "Flight", "Seats", and "Total Cost" 2. For each customer's reservations, show last name(max of 12 characters), flight number (max of 10 characters, number of seats requested, and total cost (number of seats requested * cost per seat) 3. After processing the customer's reservations, show "Total" (in the Seats column) and his/her total cost under the Total Cost column. 4. After processing all the data:
Print a table heading that shows "Flight", "Total Seats"
For each flight, show flight number and the total of all seats requested across
all customers.
Sample output:
Name Flight Seats Total Cost Moss H100.15005 2 220.00
a customer definition record containing gender, birthdate, email address, and full name. a reservation request containing flight number, number of seats requested, and cost per seat. These reservations are for the customer defined by the most recent CUST transaction.
a sentinel marking the end of the transactions for one customer. Example data for one customer:
ENDCUST
Moss Moss Moss
Corn Corn
Loafer Loafer
Sandler Sandler Sandler
Toast Toast
Flight H333.15010 H444.15001 H200.15010 H444.15015 H222.15005 H100.15005
What to turn in
H222.15005 2 H200.15010 2 H333.15010 2
Total H222.15005 10 H333.15010 5 Total H444.15001 1 H333.15010 1 Total H100.15005 3 H222.15005 3 H333.15010 3 Total H333.15010 2 H444.15015 2 Total
Total Seats 13
1 2 2
15 5
340.00 150.00 400.00
1110.00 1700.00 1000.00 2700.00
125.00 200.00 325.00 330.00 510.00 600.00
1440.00 400.00 250.00 650.00
Via Blackboard turn in one zip fle named LastnameFirstName.zip containing: o p3a.bash - bash file that runs your awk scripts and sort. It should only contain two lines
(the shebang line and the one line that invokes the awk/sort). The output should be
placed in p3a.out. o p3axxxxx.awk - multiple awk files to help arrange the names to make sorting easy (and
then change it to the final result) o p3b.bash - bash file that runs your awk script which produces output in p3b.out o p3b.awk - awk file for part B
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
