Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

yes, in awk script Write a program in Awk, that reads in numbers from the keyboard (standard input), one per line, until it detects that

image text in transcribed

yes, in awk script

Write a program in Awk, that reads in numbers from the keyboard (standard input), one per line, until it detects that a 0 (zero not an 'oh) has been entered. The 0 does not count as part of the number series. After all numbers have been entered print out the number of items entered, the sum, the minimum value entered, the maximum value entered, and the arithmetic mean (one on each line), in the order listed here. My starting point is this E!/bin/awk-f [0-9]+/{ #if the line contains any numbers apply this whole instruction # NE is the number of fields, $NF is the value of the last field # NR is the current line number if ($0 != 0 && NE == 1) { if the line is not and there's only 1 field if ($0 !-- / [A-Za-z]/) { if it contains no letters (ideally we'd expand #this to include punctuation as well) sum+= $0 add to the sum } else if ($0 == 0) { exit (0)# exits Without error END{ print sum} All L4 (AWK//1 Abbrev) ----- -UU-:**--Fl awkstats Auto-saving... done The output must look like 12.54 122334567 89877654 23.456 1.234 -100 65 # items: Sum: Maximum: Minimum: Mean: 212212223.230000 122334567.000000 -100.000000 30316031.890000

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Cite the reasons employees join unions.

Answered: 1 week ago

Question

LO4 Specify how to design a training program for adult learners.

Answered: 1 week ago