Example Analysis of awk Advanced Application in linux
This article mainly shows you the "sample analysis of advanced applications of awk in linux", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let me lead you to study and learn the article "sample analysis of advanced applications of awk in linux".
Documents before processing:
Mike Harrington: (510) 548-1278
Christian Dobbins: (408) 538-2358 purl 155purl 90pur201
Susan Dalsass: (20654-6279) 250 Swiss 60 50
Archie McNichol: (206) 548-1348; 250; 100; 175
Jody Savage: (206) 548-1278 Fraser 15 purl 188 purl
Guy Quigley: (916) 343-6410
Dan Savage: (406) 298-774415 450300 350275
Nancy McNeil: (206) 548-1278; 250; 80; 75;
John Goldenrod: (916) 348-4278
Chet Main: (510) 548-5258
Tom Savage: (408) 926-3456DUR 250MUR 168 purl 200
Elizabeth Stachelin: (916,440-1763) 17515
The required results are as follows:
* CAMPAIGN 1998 CONTRIBUTIONS***
Name PHone Jan | Feb | MAR | Total Donated
Mike Harrington 548-1278 250 100 175 525
Christian Dobbs 538-2358 155 90 201 446
Susan Dalsass 654-6279 250 60 50 360
Archie McNichol 548-1348 250 100 175 525
Jody Savage 548-1278 15 188 150 353
Guy Quigley (916) 343-6410 250 100 175 525
Dan Savage 298-7744 450 300 275 1025
Nancy McNeil 548-1278 250 80 75 405
John Goldenrod (916) 348-4278 250 100 175 525
Chet Main 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 12 contributors was $511.417.
The highest contribution was $450.
The lowest contribution was $15.
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 $1 "\ t" $2 "\ t" $3 "\ t" $4 "\ t" $5 "\ t" tot} {avg=Ttot/12} {high2= (high2 > $3)? high2:$3} {high3= (high2 > $4)? high2:$4} {high4= (high2 > $5)? high2:$5} {max12= (high2 > high3)? high2:high3} (high3 > high4)? high3:high4} {Max= (max12 > max23)? max12:max23} {low1= (low1)