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.This is in UNIX LINUX code The report summarizes sales data as recorded for

Write an awk script that produces a report from an input file.This is in UNIX LINUX code 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 "g123456.report", where g123456 is your G-id. The awk script is invoked from the command line with an input file that contains data for multiple years:

awk -f g123456.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.

Here is an example of input sales data ==> click here to download image text in transcribed

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:

% awk -f g123456.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

%

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

Students also viewed these Databases questions