Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Write an awk script that implements a report writer. Program The report computes summary data on the performance of sales associates for our company

Assignment

Write an awk script that implements a report writer.

Program

The report computes summary data on the performance of sales associates for our company "No-op Computing.".

The awk script file name must be "123456.list"

The script should compute the sale amounts per associate for the year 2013 and print them in a sorted list ranked according to the sales amount.

The awk script is invoked from the command line with an inputfile that contains data on products, associates and sales, possibly for multiple years: awk -f 123456.list inputfile Input

1 .The lines in the input file use ":" as field separator. There are 3 types of lines in the file:

-lines that describe products have the following

-fields: product id: an integer number product

-category: alphanumeric text description:

-alphanumeric text

-price: floating point number, with 2 significant digits

-lines that describe associates have the following fields:

2.associate id: an integer number name:

-alphanumeric text position:

-alphanumeric text

3.lines that describe sales have the following fields:

-transaction id:

-an integer number product id:

-an integer number quantity:

-an integer number

-date: in the form of mm/dd/yyyy associate id:

-an integer number

Error Checking

If any error is encountered, such as incorrect data in the input file, just skip the line in question. Nothing further needs to be done to recover and use the values of the line.

Output

% awk -f z123456.list inputfile11

No-op Computing

2013 Sales Associates Ranking

Name Position Sales Amount

======================================

Buck, Fast Developer 2628.80

Rush, George Salesman 1051.77

Worker, Susan Developer 360.00

Doe, John Clerk 134.01

Lindon, Rosemary Producer 31.00

Miller, Dennis Comedian 9.90

%

Other

make sure that your assignment is contained in a single file called "123456.list"

make sure that your awk script runs fine on Linux

Make sure that your script file is a regular Unix text file. Don't add an extension (such as .txt) to the file name. Don't modify your file on Windows using notepad, it will add extra ^M characters at the end of each line.

Input file

1:software:Word Processor:55.00

2:software:Bad Wolf Video Game:19.99

3:software:Return to Gallifrey Video Game:59.99

4:vehicle:TARDIS:999999.99

5:hardware:sonic screwdriver:9999.99

6:merchandise:company t-shirt:20.00

1:Davy Jones:Security

2:Ricky Davis:Developer

3:Samantha Smith:Salesperson

4:Matt Smith:Doctor

5:David Tennant:Doctor

6:Buckminster Fuller:Engineer

7:Clara Oswald:Nurse

8:Amelia Pond:Nurse

1:1:1:01/02/2011:2

2:2:1:02/04/2012:2

3:3:1:03/06/2013:5

4:4:1:11/05/2013:5

5:1:1:01/12/2013:2

6:2:2:02/11/2013:2

7:3:1:05/13/2013:6

8:6:3:06/24/2013:1

9:5:1:02/02/2011:5

10:1:1:05/01/2012:5

11:2:1:11/05/2013:5

12:3:1:12/06/2013:5

13:2:1:02/12/2013:5

14:1:1:10/16/2013:5

15:6:4:05/18/2013:3

16:5:1:06/28/2013:6

17:1:1:07/30/2013:5

18:2:1:08/04/2013:7

19:3:1:09/07/2013:5

18:2:1:08/04/2013:7

19:3:1:09/07/2013:5

20:6:1:10/17/2013:4

20:6:1:10/17/2013:8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Is racial harassment addressed by the EEOC? Explain.

Answered: 1 week ago