open(SAR, 'your sar command|');
while(<SAR>){
# now process the output of sar one line at a time.
} Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
OK -- that depends on the options you are giving to sar when you run it.
If you'd like to post a few lines of that output I'm sure that I, or someone else here, would be able to get you going with a perl script to process it. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
What I would like to know is waht is the CR and LF ASCII nums. What I thing I will do is:
@data=split /$CR$LF/,sar
Read the @data[3]
e.g. usr=split /<4 space chars>/,@data[3]
first of all, we don't care about the title line, so we can just reject that
Next - we split up the data line into some variables
Like this, with the open bit from my previous post
while(<SAR>){
next if /usr/; # reject title line
($tm,$usr,$sys,$wio,$idle) =
split(/\s+/);
# and now do something with the data
}
the split() function chops up the line based on spaces (that's the /\s+/ bit)
with me?
If you are, what is it you'd like to do with this data? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
not sure what you mean by perl headers Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.