Operating System - HP-UX
1847240 Members
2676 Online
110263 Solutions
New Discussion

Exclude output from sar in a shell script

 
SOLVED
Go to solution
wvsa
Regular Advisor

Exclude output from sar in a shell script

Good day all;

Need some help with a script, how can exclude from the following sar output the references to c0t0d0 and c2t0d0.

c0t0d0 2.79 0.50 4 33 0.00 8.78
c2t0d0 1.99 0.50 3 28 0.00 7.59
c10t0d1 0.20 0.50 0 0 0.00 4.29
c12t3d1


Thank you for your input.

Norm
4 REPLIES 4
Christian Tremblay
Trusted Contributor

Re: Exclude output from sar in a shell script

Pipe your output through grep with the -v switch:

sar |grep -v c0t0d0|grep -v c0t0d0
Heironimus
Honored Contributor

Re: Exclude output from sar in a shell script

Pipe it to grep -v. Something like this should do it for you.

grep -ve '^c[02]t0d0[[:space:]]'
Christian Tremblay
Trusted Contributor

Re: Exclude output from sar in a shell script

should be:

sar |grep -v c0t0d0|grep -v c2t0d0
Yang Qin_1
Honored Contributor
Solution

Re: Exclude output from sar in a shell script

sar 5 10| grep -vE "c0t0d0|c2t0d0"


Yang