Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an awk script that produces a report from an input file. The report summarizes sales data as recorded for sales stations. The input file

Write an awk script that produces a report from an input file. The report summarizes sales data as recorded for sales stations. The input file contains sales data for several years, however, your report should only list data for the year 2014.

The awk script file name must be "z123456.report", where z123456 is your Z-id. The awk script is invoked from the command line with an input file that contains data for multiple years:

awk -f z123456.report inputfile. txt

The lines in the input file have the following fields:

  • year: four digit integer number
  • month: three letter abbreviation of a month
  • station: one letter station code
  • sale amounts: floating point numbers, with 2 significant digits. Each input line will have at least one and at most 10 amount fields.

 2011 Jan X 29.44 17.33 43.21 2014 Jan Y 32.32 12.12 99.00 1.99 2012 Jan X 321.11 12.34 10.99 2012 Feb Y 1.99 12.75 2012 Feb X 32.99 65.78 98.76 2014 Jan Y 12.99 17.44 21.34 2012 Mar X 11.45 ...

Your awk script should produce a report that lists the 2014 sales amount per month and station. In addition the report should list the sum of all sales per station for the year 2014, the total sales for the year, and how many records from the input file were processed.

Here is an example of the script invocation using the sample input file provided above:

image text in transcribed

awk -f z123456.report input file.txt Sales Data for year 2014 Jan: 145.43 Jan: Mar: Aug: 343.88 Dec: Nov: 410.09 Dec: 331.76 51.77 10.00 29.97 Station volume for 2014 X: 1095.73 Y 197.20 29.97 Total: 1322.90 7 records processed

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

Describe the team performance model.

Answered: 1 week ago

Question

2 What supply is and what affects it.

Answered: 1 week ago