![]() |
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 |
| how to find the number of files | harish409 | UNIX for Dummies Questions & Answers | 5 | 10-09-2007 09:09 AM |
| Script to move certain number of files every 10 minutes. | amitsayshii | UNIX for Dummies Questions & Answers | 1 | 02-26-2007 04:55 AM |
| awk script to find the number of files | uni_ajay_r | Shell Programming and Scripting | 4 | 10-31-2006 06:58 PM |
| Script to generate Average Values | gagan.delouri | Shell Programming and Scripting | 5 | 05-03-2006 05:29 AM |
| How to find no of occurances Finding average time? | redlotus72 | UNIX Desktop for Dummies Questions & Answers | 1 | 02-21-2005 03:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
As it happens, I just wrote one.
Code:
vnix$ cat ~/bin/avg
#!/usr/bin/perl -lan
my $sum = 0.0;
map { $sum += $_ } grep { /^(\d+(\.\d+)?|\.\d+)$/ } @F;
print "$0: $sum / ", scalar (@F), " = ", $sum / @F if @F;
Last edited by era; 03-27-2008 at 12:36 PM.. Reason: Usage instructions |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|