![]() |
|
|
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 |
| Average in awk | saint2006 | Shell Programming and Scripting | 6 | 06-19-2008 03:09 PM |
| how to average in awk | saint2006 | Shell Programming and Scripting | 4 | 06-04-2008 12:29 PM |
| Average Time | sambond | UNIX for Dummies Questions & Answers | 1 | 01-16-2008 10:57 AM |
| Low average cpu utilization. | Moodie | SUN Solaris | 3 | 12-11-2007 07:25 PM |
| average value | su_in99 | UNIX for Dummies Questions & Answers | 2 | 03-10-2007 01:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
get min, max and average value
hi! i have a file like the attachement. I'd like to get for each line the min, max and average values. (there is 255 values for each line) how can i get that ? i try this, is it right? Code:
BEGIN {FS = ","; OFS = ";";max=0;min=0;moy=0;total=0;freq=890}
$0 !~ /Trace1:/ {
max=min=moy=total=$1
for (i=2;i<=NF;i++)
{ if ($i>max) {max=$i}
if ($i<min) {min=$i}
total=total+$i
}
print freq,min,max,total/255
freq=freq+0,202
}
END {}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|