1753897 Members
7743 Online
108809 Solutions
New Discussion юеВ

sar -uq

 
SOLVED
Go to solution
chin hyeon jung
Advisor

sar -uq

Iwant to see the result of sar -uq 1 2 in one line
So I made this
sar -uq 1 2 |awk '{ print $0,$1,$2,$3,$4}'
But it give me wrong result
Do you have any idea or solutin ?
4 REPLIES 4
S.K. Chan
Honored Contributor

Re: sar -uq

HP-UX mars B.11.11 U 9000/785 05/16/02

19:17:24 %usr %sys %wio %idle
runq-sz %runocc swpq-sz %swpocc
19:17:25 0 0 0 100
3.0 99 0.0 0
19:17:26 0 0 0 100
1.0 100 0.0 0

Average 0 0 0 100
Average 2.0 100 0.0 0

The above is a sample of sar -uq 1 2 output. As you can see you need to do some filtering before you can get what you actually wanted because it has different info in the same column. How do you want the "one-line" output to look like. Give us an example ..
Sridhar Bhaskarla
Honored Contributor

Re: sar -uq

hmmm... let me try.. don't have a system.. You may need to make some adjustments. I am using Chan's example

sar -uq 1 2 |sed '/HP-UX/d'|awk '{ l = NR % 2 ; if (l) printf ("%s", $0) ;else print $0 }'



-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven Sim Kok Leong
Honored Contributor

Re: sar -uq

Hi,

If you wish to get the averages of -u and -q all on the same line, simply do this:

# echo `sar -uq 1 2 | grep Average`

Hope this helps. Regards.

Steven Sim Kok Leong
Sridhar Bhaskarla
Honored Contributor
Solution

Re: sar -uq

Hi (again),

You may get a better output if you modify it like this.

sar -uq 1 2 |sed '/HP-UX/d'|awk '{ l = NR % 2 ; if ( l = 1 ) printf ("%s", $0) ;else print $0 }'

-Sri
You may be disappointed if you fail, but you are doomed if you don't try