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

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
Get step-by-step solutions from verified subject matter experts
