![]() |
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 |
| tail -f | wannalearn | Shell Programming and Scripting | 4 | 04-10-2007 05:22 PM |
| tail command.. | amon | Shell Programming and Scripting | 2 | 06-02-2006 04:36 AM |
| Help on scripting using tail | jisc | Shell Programming and Scripting | 4 | 05-19-2006 03:15 AM |
| how to sed with tail | redlotus72 | UNIX for Dummies Questions & Answers | 1 | 08-30-2005 05:27 AM |
| using tail -f | cdunavent | Shell Programming and Scripting | 6 | 10-23-2002 05:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Tail??
Hello all,
I have search the forum and could not find an answer...Here is what I am trying to do. Every 15 minutes, a script send uptime output to a logfile (dailylog.log), that file contains lines like the one below: Code:
11:21am up 44 days, 19:15, 1 user, load average: 0.00, 0.02, 0.03 Code:
echo $(tail -10 /dailyload.log) |
|
||||
|
Tks Jim. Now what I do is putting the 13th argument of uptime command in a variable, the load, let's say 0.06 and now adding the last 24 hours load and doing an average of the total. Here is what I am trying to do:
Code:
#!/usr/bin/ksh
I_COUNT=96
C_CHAINE=0
until ((I_COUNT < 1))
do
tail -$I_COUNT /dailyload.log | head -1 | awk '{print $13}' > $C_CHAINE
#average
((C_CHAINE=C_CHAINE+$13))
((I_COUNT=I_COUNT-1))
done
((C_CHAINE=C_CHAINE/96))
echo $C_CHAINE
|
|
||||
|
It looks like you are taking the last 96 lines from the log and finding the mean of column 13.
Code:
tail -96 logfile | \
awk 'BEGIN { total=0 } { total+=$13 } END{ printf("Avg=%f\n", total/NR) }'
|
![]() |
| Bookmarks |
| Tags |
| load average, performance |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|