- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sar -d output reformatting
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
тАО08-23-2007 10:14 AM
тАО08-23-2007 10:14 AM
Is there some way (script or otherwise)to reformat the output of the sar -d output to put the time stamp on every line? For example I have the following output (truncated):
13:02:00 c0t1d0 3.23 0.50 3
c0t0d0 0.13 0.50 0
c2t0d0 0.08 0.50 0
I would like to be able to get the "13:02:00" on all three lines and haven't come up with a way to do it.
TIA. Rex
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2007 11:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2007 02:10 PM
тАО08-23-2007 02:10 PM
Re: sar -d output reformatting
sar -d 3 3 | perl -pe 'if (/^([0-9:]+)/){$t=$1} else {s/^( ){8}/$t/}'
-p --> makes perl loop
^([0-9:]+) --> matches and remember a timestamp at start of line
s/^( ){8}/$t/ --> replaces 8 spaces, and only 8 spaces, at begin of line with last time seen
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2007 02:14 AM
тАО08-24-2007 02:14 AM
Re: sar -d output reformatting
Rex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2007 02:15 AM
тАО08-24-2007 02:15 AM
Re: sar -d output reformatting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2007 02:40 AM
тАО08-24-2007 02:40 AM
Re: sar -d output reformatting
Learn enough 'awk' to be able to read, understand and modify existing scripts.
http://www.gnu.org/software/gawk/manual/
Then, use Perl! Perl has an extremely robust, feature-extensive regular expression engine built into it. With Perl you can parse anything. Many things that would otherwise require you to write in C can be done with ease and speed of development in Perl.
http://learn.perl.org/
Regards!
...JRF...