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
Which behavior could be acceptable at a classical concert as well as at a ball game? standing for an exceptional performance che
Lady_Fox [76]
Standing for an exceptional performance would be normal "acceptable" in both scenarios.
7 0
3 years ago
Read 2 more answers
1. Ce este o baza de date? (1p)
lesya [120]

Answer:

would you mind telling me what this says im still learning my spanish

Explanation:

6 0
2 years ago
Read 2 more answers
A two-dimensional array of ints, has been created and assigned to a2d. Write an expression whose value is the number of rows in
Contact [7]

Explanation:

oi.........................

7 0
3 years ago
When a vehicle strikes a pedestrian, it's most often during A. a period of darkness or low visibility B. the day when pedestrian
yuradex [85]

Answer:

A. a period of darkness or low visibility

Explanation:

When a vehicle strikes a pedestrian, it's most often during a period of darkness or low visibility.

8 0
3 years ago
Read 2 more answers
Jqiom:FNU Ojlak toiha 438oy9ctu4jmpvke,u9wjm8i
Mazyrski [523]

Answer:

dfghgfdfghgfdfghgfdfghjhgfdfghjhgfdfghjhgfghjhgferghjhre

Explanation:

3 0
3 years ago
Other questions:
  • How to track flash socket server connections wireshark?
    10·1 answer
  • What is the automotive name for the large wires that allow more electrical current to flow ?
    12·1 answer
  • what is it called when someone uses software to run multiple operating systems on one computer at the same time? A.functional vi
    9·1 answer
  • Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
    15·1 answer
  • Which of the following is not a command for determining if MySQL is running on Linux (Ubuntu)?
    7·1 answer
  • What type of technology we need to use in order to make sure that users can freely room from one room to another one without wi-
    14·1 answer
  • Discuss, in detail, the usefulness of graphics and images in program development. Explain the importance of the interface of a c
    7·1 answer
  • How do you fix this!!!!
    5·1 answer
  • Tyra is peer conferencing about her project with a friend. Tyra's friend provided feedback that Tyra does not agree with. What s
    6·1 answer
  • You need to update your router settings, so you log into the administration panel, Whose Internet protocol (IP) address is 192.1
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!