Hello I am new to Shell Scripting
SUN OS 5.9
I want out put in this format
i am able to get output but not able to get
The highest contribution was $300.00.
The lowest contribution was $15.00.
and I am getting extra lines in the output, I don't know why.
can any one please help me.
my fine contains as under
Thank you in advance
SUN OS 5.9
I want out put in this format
Code:
***CAMPAIGN 1998 CONTRIBUTIONS***
---------------------------------------------------------------------------
NAME PHONE Jan | Feb | Mar | Total Donated
---------------------------------------------------------------------------
Mike Harrington (510) 548-1278 250.00 100.00 175.00 525.00
Christian Dobbins (408) 538-2358 155.00 90.00 201.00 446.00
Susan Dalsass (206) 654-6279 250.00 60.00 50.00 360.00
Archie McNichol (206) 548-1348 250.00 100.00 175.00 525.00
Jody Savage (206) 548-1278 15.00 188.00 150.00 353.00
Guy Quigley (916) 343-6410 250.00 100.00 175.00 525.00
Dan Savage (406) 298-7744 450.00 300.00 275.00 1025.00
Nancy McNeil (206) 548-1278 250.00 80.00 75.00 405.00
John Goldenrod (916) 348-4278 250.00 100.00 175.00 525.00
Chet Main (510) 548-5258 50.00 95.00 135.00 280.00
Tom Savage (408) 926-3456 250.00 68.00 200.00 618.00
Elizabeth Stachelin (916) 440-1763 175.00 75.00 300.00 550.00
----------------------------------------------------------------------------
SUMMARY
----------------------------------------------------------------------------
The campaign received a total of $6137.00 for this quarter.
The average donation for the 12 contributors was $511.42.
The highest contribution was $300.00.
The lowest contribution was $15.00.
The highest contribution was $300.00.
The lowest contribution was $15.00.
and I am getting extra lines in the output, I don't know why.
can any one please help me.
Code:
***CAMPAIGN 1998 CONTRIBUTIONS***
-------------------------------------------------------------------------------
Name PHONE | Jan | Feb | Mar | Total Donated
--------------------------------------------------------------------------------
0.00 0.00 0.00 0.00
Mike Harrington:(510) 548-1278:250:100:175
Mike Harrington (510) 548-1278 250.00 100.00 175.00 525.00
0.00 0.00 0.00 0.00
Christian Dobbins:(408) 538-2358:155:90:201
Christian Dobbins (408) 538-2358 155.00 90.00 201.00 446.00
0.00 0.00 0.00 0.00
Susan Dalsass:(206) 654-6279:250:60:50
Susan Dalsass (206) 654-6279 250.00 60.00 50.00 360.00
0.00 0.00 0.00 0.00
Archie McNichol:(206) 548-1348:250:100:175
Archie McNichol (206) 548-1348 250.00 100.00 175.00 525.00
0.00 0.00 0.00 0.00
Jody Savage:(206) 548-1278:15:188:150
Jody Savage (206) 548-1278 15.00 188.00 150.00 353.00
0.00 0.00 0.00 0.00
Guy Quigley:(916) 343-6410:250:100:175
Guy Quigley (916) 343-6410 250.00 100.00 175.00 525.00
0.00 0.00 0.00 0.00
Dan Savage:(406) 298-7744:450:300:275
Dan Savage (406) 298-7744 450.00 300.00 275.00 1025.00
0.00 0.00 0.00 0.00
Nancy McNeil:(206) 548-1278:250:80:75
Nancy McNeil (206) 548-1278 250.00 80.00 75.00 405.00
0.00 0.00 0.00 0.00
John Goldenrod:(916) 348-4278:250:100:175
John Goldenrod (916) 348-4278 250.00 100.00 175.00 525.00
0.00 0.00 0.00 0.00
Chet Main:(510) 548-5258:50:95:135
Chet Main (510) 548-5258 50.00 95.00 135.00 280.00
0.00 0.00 0.00 0.00
Tom Savage:(408) 926-3456:250:168:200
Tom Savage (408) 926-3456 250.00 168.00 200.00 618.00
[b] 0.00 0.00 0.00 0.00
Elizabeth Stachelin:(916) 440-1763:175:75:300[/b]
Elizabeth Stachelin (916) 440-1763 175.00 75.00 300.00 550.00
0.00 0.00 0.00 0.00
-------------------------------------------------------------------------------
SUMMARY
-------------------------------------------------------------------------------
The total reveived for this quater is :$6137.00
The the avgerage total :$511.42
Code:
BEGIN{FS=":"
printf "\n\t\t\t***CAMPAIGN 1998 CONTRIBUTIONS***\n\n"
print "-------------------------------------------------------------------------------"
printf"Name\t\t\tPHONE\t\t| Jan | Feb | Mar | Total Donated\n"
print "--------------------------------------------------------------------------------"
}
{tot=$3+$4+$5}
qtr_tot=qtr_tot+tot
{printf"%-20s\t%s\t%4.2f\t%4.2f\t%3.2f\t%3.2f\n",$1,$2,$3,$4,$5,tot}
END{print "-------------------------------------------------------------------------------"
print"\t\t\t\t SUMMARY"
print "-------------------------------------------------------------------------------"
{printf"The total reveived for this quater is :$%6.2f\n",qtr_tot}
{printf"The the avgerage total :$%6.2f\n",qtr_tot/12}
}
Thank you in advance