Write anawkscript 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...

1 answer below »

Write anawkscript 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.


Theawkscript file name must be "z123456.report", where z123456 is your Z-id.


Theawkscript is invoked from the command line with an input file that contains data for multiple years:


awk-f z123456.reportinputfile.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.


Here is an example of input sales data ==>click here to download

Click for more options




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

...





Yourawkscript 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:






% awk -f z123456.report inputfile.txt

Sales Data for year 2014

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

Jan: 145.43

Jan: 51.77

Mar: 10.00

Aug: 343.88

Dec: 29.97

Nov: 410.09

Dec: 331.76

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

Station volume for 2014 is:

X: 1095.73

Y: 197.20

Z: 29.97

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

Total: 1322.90

7 records processed


%




Error Checking:


If any error is encountered, such as incorrect data in the input file, just skip the line in question.


Additional notes:



  • make sure that your assignment is contained in a single file called "z123456.report" based on your Z-id

  • Make sure that yourawkscript runs fine on Linux,turingor hopper.

  • Make sure that your report 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.


Submit your assignment as a single file via Blackboard below before the deadline.

Answered 311 days AfterMar 02, 2021

Answer To: Write anawkscript that produces a report from an input file. The report summarizes sales data as...

Darshan answered on Jan 07 2022
122 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here