Operating System - HP-UX
1833875 Members
3291 Online
110063 Solutions
New Discussion

Re: need help with a script

 
S-un-B-ix-S
Advisor

need help with a script

I need help with a script I am trying - I was hoping that someone would have a more elegant solution that what i have come up.

I have 6 files in the following directory -

(named like this)
/tmp/file1
/tmp/file-2
/tmp/file-3
/tmp/file-4
/tmp/file-5
/tmp/file-6

Each file contains the following:

Tue Jun 20 2006 06:30AM EDT 0.66

I need to open each file - grab the last field (0.66) - sum it with all of the numbers out of the other files- take an average- and place the average in a separate file.

I had done it by using, cat, awk, assigning the number to variable, and then adding all of up and dividing by 6.

I am a beginner at shell scripting so I am sure there is a more "elegant" way to do this, and I would be very interested to see other perspectives.
1 REPLY 1
S-un-B-ix-S
Advisor

Re: need help with a script

Double submission ....