- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scripting help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 08:50 AM
тАО10-30-2001 08:50 AM
I want to take the average line and totals and add each days average line to this file so that I have approximately a file with 30 days of my sar data in it?
I have a cron job that produces this report each day. The output file it creates each day is called hostname_monthday. example would be:
system1_1029 for yesterdays output of this report.
21:45:00 3 3 2 92
22:00:01 3 3 2 92
22:15:00 9 7 53 32
22:30:00 3 4 91 1
22:45:00 3 5 91 1
23:00:00 3 5 91 1
23:15:00 3 4 91 1
23:30:00 3 4 91 1
23:45:00 3 4 90 2
Average 21 6 24 50
How can I accomplish this?
Please advise?
Vito
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 08:58 AM
тАО10-30-2001 08:58 AM
Re: scripting help
tail -1 hostname_month >>collect_file
tail -1 gets the last line and >> will append it to collect_file
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 08:59 AM
тАО10-30-2001 08:59 AM
Re: scripting help
LOG=$(date +%m).Summary
echo "$DATE
\c ">> $LOG
sar -f
This would put a date and the average line from sar into a file called $LOG, i.e. monthy.Summary. Just have to define the DATE variable.
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 08:59 AM
тАО10-30-2001 08:59 AM
Re: scripting help
Based on your output here is how you would get the last line from your file
cat FILENAME | awk '{ print $5 }' > OUTPUT
To use mathmatical formulas look at the expr command
A simple example would be:
AVG=`expr TOTAL/30`
These should get you started down the right road.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 09:00 AM
тАО10-30-2001 09:00 AM
Re: scripting help
If I understand properly you need last line only. easy
#tail -1 filename >> outputfile
But I think you that is not what you want because it is seems too easy.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 09:02 AM
тАО10-30-2001 09:02 AM
Re: scripting help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 09:10 AM
тАО10-30-2001 09:10 AM
Re: scripting help
I have 30 of the system1_1029, system1_1028,system1_1027 yada, yada, down to system1_1001...
So if i tail all of them, how do i get all the average lines into one output file?
Please advise?
Vito
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 09:29 AM
тАО10-30-2001 09:29 AM
Re: scripting help
for hostfile in system1* ; do
last -1 $hostfile >>collect_file
done
This will extract the last line of each of the files and append onto collect_file
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2001 09:31 AM