Today to see the Unix shell example fine solution on the Youdao awk on the topic after doing it to share with you
Pre-processing documents:
Mike Harrington: (510) 548-1278:250:100:175
Christian Dobbins: (408) 538-2358:155:90:201
Susan Dalsass: (206) 654-6279:250:60:50
Archie McNichol: (206) 548-1348:250:100:175
Jody Savage: (206) 548-1278:15:188:150
Guy Quigley: (916) 343-6410:250:100:175
Dan Savage: (406) 298-7744:450:300:275
Nancy McNeil: (206) 548-1278:250:80:75
John Goldenrod: (916) 348-4278:250:100:175
Chet Main: (510) 548-5258:50:95:135
Tom Savage: (408) 926-3456:250:168:200
Elizabeth Stachelin: (916) 440-1763:175:75:300
The results required are as follows:
CAMPAIGN 1998 contributions***
Name PHone | Feb | MAR | Total donated
---------------------------------------------------------------------------------
Mike Harrington (510) 548-1278 250 100 175 525
Christian Dobbs (408) 538-2358 155 90 201 446
Susan Dalsass (206) 654-6279 250 60 50 360
Archie McNichol (206) 548-1348 250 100 175 525
Jody Savage (206) 548-1278 15 188 150 353
Guy Quigley (916) 343-6410 250 100 175 525
Dan Savage (406) 298-7744 450 300 275 1025
Nancy McNeil (206) 548-1278 250 80 75 405
John Goldenrod (916) 348-4278 250 100 175 525
Chet Main (510) 548-5258 50 95 135 280
Tom Savage (408) 926-3456 250 168 200 618
Elibeth Stachel (916) 440-1763 175 75 300 550
SUMMARY
-----------------------------------------------------------------------------------
The Campan received atotal of $6137 for this quarter
Average donation for the contributors is $511.417.
The highest contribution was $450.
The lowest contribution was $.
The code is as follows:
Begin{fs= ":"; low1=300;low2=400;low3=500 ofs= "\ T" Print \t\t***campaign 1998 contributions***\n "Print"----- ----------------------------------------------------------------------------\ n "Print" Name\t\t\tphone\t\t\tjan | \tfeb |\tmar |\ttotal donated "print"----------------------------------------------------------------------------- ----\ n} {tot=$3+$4+$5} {Ttot+=tot} {print $, \ t $ \t\t "$" \ T "$" \ T "$" \ T "tot} {AVG=TTOT/12} {high1= (high1> $)? High1:$3} {high2= (high1>$4)? High1:$4} {high3= (high1>$5)? High1:$5} {max12= (HIGH1>HIGH2)? HIGH1:HIGH2} { max23= (HIGH2>HIGH3)? High2:high3} {max= (max12>max23)? max12:max23} {low1= (low1<$3)? Low1:$3} {low2= (Low1 <$4)? low1:$4} {low3= (low1<$5) low1:$5} {min12= (low1<low2)? Low1:low2} {min23= (LOW2<LOW3)? Low2:low3} { Min= (min12<min23) min12:min23} end{print "------------------------------------------------------------------- ----------------"print" \t\tsummary "print"-----------------------------------------------------------------------------------"printf" the Campan received Atotal of $ ";p RI NTF Ttot; print ' For this quarter ' printf ' average donation for the ' contributors was $ ';
printf avg;p rint "."
printf "The highest contribution was $";p rintf max;print "."
printf "The lowest contribution was $";p rintf min;print "." }