1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
e-lub [12.9K]
3 years ago
8

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. Here is an example of input sales data
Computers and Technology
1 answer:
Hatshy [7]3 years ago
8 0

Answer:

Script is given below

Explanation:

Below is the AWK code for the Report.I have used the sample data that your have shared in the question.

AWK code-

echo "Hello World!"

echo "2011 Jan X 29.44 17.33 43.21" > inputfile.txt

echo "2014 Jan Y 32.32 12.12 99.00 1.99 " >> inputfile.txt

echo "2012 Jan X 321.11 12.34 10.99" >> inputfile.txt

echo "2012 Feb Y 1.99 12.75" >> inputfile.txt

echo "2012 Feb X 32.99 65.78 98.76" >> inputfile.txt

echo "2014 Jan Y 12.99 17.44 21.34" >> inputfile.txt

echo "2012 Mar X 11.45" >> inputfile.txt

awk -F" " 'BEGIN{ X_sum=0;

print(" Sales Data for year 2014")

print("========================")

}

{ if($1=="2014")

{

print($2,":", $4+$5+$6+$7+$8+$9+$10+$11+$12+$13)

}

if($3=="X")

{

X_sum=X_sum+$4+$5+$6+$7+$8+$9+$10+$11+$12+$13

}

if($3=="Y")

{

Y_sum=Y_sum+$4+$5+$6+$7+$8+$9+$10+$11+$12+$13

}

if($3=="Z")

{

Z_sum=Z_sum+$4+$5+$6+$7+$8+$9+$10+$11+$12+$13

}

 

}

END { print(" ========================")

print("Station volume for 2014 is:")

print("X:" ,X_sum )

print("Y:" ,Y_sum )

print("Z:" ,Z_sum )

}

' < inputfile.txt

You might be interested in
Namecoin is an alternative blockchain technology that is used to implement decentralized version of Routing Banking System.A. Tr
vova2212 [387]

Answer:

False

Explanation:

Namecoin is a type of crypto currency which was originally pronged from Bitcoin software. It is coded in the fashion of Bitcoin with the same algorithm as well. Hence it is not a blockchain technology that is used to implement decentralized version of Routing Banking System. Namecoin can store data within its own blockchain transaction database.

4 0
3 years ago
The Clean Air Act Amendments of 1990 prohibit service-related releases of all ____________. A) GasB) OzoneC) MercuryD) Refrigera
velikii [3]

Answer:

D. Refrigerants

Explanation:

In the United States of America, the agency which was established by US Congress and saddled with the responsibility of overseeing all aspects of pollution, environmental clean up, pesticide use, contamination, and hazardous waste spills is the Environmental Protection Agency (EPA). Also, EPA research solutions, policy development, and enforcement of regulations through the resource Conservation and Recovery Act .

The Clean Air Act Amendments of 1990 prohibit service-related releases of all refrigerants such as R-12 and R-134a. This ban became effective on the 1st of January, 1993.

Refrigerants refers to any chemical substance that undergoes a phase change (liquid and gas) so as to enable the cooling and freezing of materials. They are typically used in air conditioners, refrigerators, water dispensers, etc.

4 0
2 years ago
What types of roles are there as a webmaster?
Nuetrik [128]
<span> PHP, ASP, and Javascript. They handle the technical aspects </span>
6 0
3 years ago
Read 2 more answers
Which term means a cryptography mechanism that hides secret communications within various forms of data?.
andrezito [222]

Answer:

anything u have daling

Explanation:

6 0
2 years ago
You work for the Contoso Corporation. You have a server that acts as a file server for clients. You must make sure that the serv
Anika [276]
Get a dedicated server with 6-10gb RAM, which might be able to run a lot, while staying up with no lag.
6 0
3 years ago
Other questions:
  • Write a program that prompts the user to enter a string (may contain spaces) and displays its last character. Enter s string: Pr
    13·1 answer
  • 3-Write a program in some language that has both static and stack dynamic local variables in subprograms. Create six large (at l
    9·2 answers
  • Where is line-of-sight Internet common?<br> In space<br> Outdoors<br> Inside<br> In businesses
    5·1 answer
  • How is a correction made to an Electronic health record?
    14·1 answer
  • Which do web servers host?<br> Websites<br> Networks<br> Firewalls<br> Zones
    8·1 answer
  • The primary benefit of a VPN that uses _________ is that an intercepted packet reveals nothing about the true destination system
    6·1 answer
  • in java how do i Write a Java program that takes ten numbers as input to calculate and print the average of the numbers.
    11·1 answer
  • Which domain indicates that a website is sponsored by a university or college?
    12·1 answer
  • Write down the bit pattern in the fraction of value 1/3 assuming a floating point format that uses Binary Coded Decimal (base 10
    10·1 answer
  • To find information on a network use a ____
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!