![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Timestamp comparison | zainravi | Shell Programming and Scripting | 1 | 01-21-2008 08:28 AM |
| Unix comparison | NewGuy100 | UNIX for Dummies Questions & Answers | 1 | 12-14-2005 04:42 PM |
| comparison problem | ranj@chn | Shell Programming and Scripting | 8 | 11-05-2005 07:03 AM |
| dir comparison help | ghazi | Shell Programming and Scripting | 5 | 12-20-2004 05:54 PM |
| comparison | cnf | Filesystems, Disks and Memory | 2 | 05-14-2002 01:52 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
need some help..Comparison
I need some help which would probably be for most of you a simple script.
I need to read in the data from a .dat file and then compare avg to see who is the highest avg. Here is my script so far. Code:
#!/bin/ksh #reading in the data from lab3.dat filename=$1 while read name o1 o2 o3 o4 o5 o6 o7 o8 o9 o10 ; do avg=0 sum=0 #adding in the information for one person #for (( k=0 ; k<20 ; k++ )) (( sum=$o1+$o2+$o3+$o4+$o5+$o6+$o7+$o8+$o9+$o10 )) #getting the avg from one person (( avg=$(echo "scale=4 ; ($sum/10)" | bc) )) sd=0 (( sd=$(echo "scale=8 ; sqrt((((($o1-$avg)^2+($o2-$avg)^2+($o3-$avg)^2+($o4-$avg)^2+($o5-$avg)^2)+($o6-$avg)^2+($o7-$avg)^2+($o8-$avg)^2+($o9-$avg)^2+($o10-$avg)^2)/10))" | bc) )) echo $name $avg $sd done < $filename Last edited by vino; 02-24-2008 at 11:54 PM.. Reason: introduced code tags |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|