- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script Performance
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
Forums
Discussions
Discussions
Discussions
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
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
04-27-2007 04:19 AM
04-27-2007 04:19 AM
i would like the output of my script in the same line, example:
Apr 27 2007 system 17 3 2 78
DATA=`date|awk '{print $2,$3,$6}'`
echo $DATA >> /tmp/perf_cpu.txt
sar -uM 1 1 | tail -1 >> /tmp/perf_cpu.txt
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2007 04:44 AM
04-27-2007 04:44 AM
Solutionhere it is
# DATA=`date|awk '{print $2,$3,$6}'`.
# TEST=`sar -uM 1 1 | tail -1`
# echo $DATA $TEST > /tmp/perf_cpu.txt
# more /tmp/perf_cpu.txt
Apr 27, PM. system 0 0 0 100
Regards
Aussan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2007 04:45 AM
04-27-2007 04:45 AM
Re: Script Performance
here it is
# DATA=`date|awk '{print $2,$3,$4}'`.
# TEST=`sar -uM 1 1 | tail -1`
# echo $DATA $TEST > /tmp/perf_cpu.txt
# more /tmp/perf_cpu.txt
Apr 27, 2007 system 0 0 0 100
Regards
Aussan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2007 05:00 AM
04-27-2007 05:00 AM
Re: Script Performance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2007 05:06 AM
04-27-2007 05:06 AM
Re: Script Performance
echo $DATA >> /tmp/perf_cpu.txt
to this:
echo "${DATA} \c" >> /tmp/perf_cpu.txt
However, you really don't need awk to format the date output:
so I would change:
DATA=`date|awk '{print $2,$3,$6}'`
to :
DATA=$(date '+%b %d %Y')
so that a better version of your script should be very close to this:
---------------------------------
#!/usr/bin/sh
OFILE=/tmp/perf_cpu.txt
DATA=$(date '+%b %d %Y')
echo "${DATA} \c" >> ${OFILE}
sar -uM 1 1 | tail -1 >> ${OFILE}