delphys
1
Hello folks
I have the following output
UNIX95=1 ps -ef -o pcpu,user,pid,args |more
%CPU USER PID COMMAND
0.03 root 0 swapper
0.08 root 1 init
0.00 root 13 net_str_cached
0.00 root 12 usbhubd
0.00 root 11 escsid
0.00 root 10 ttisr
0.02 root 9 ksyncer_daemon
0.00 root 8 ioconfigd
0.00 root 7 kai_daemon
0.04 root 6 kmemdaemon
0.00 root 5 signald
0.00 root 14 net_str_cached
I would like to keep the first line (NR==1) and the sort on the cpu (first)field
Would this be possible with awk ??
TIA
Don't think awk is really applicable here.
UNIX95=1 ps -ef -o pcpu,user,pid,args |
( head -n 1
sort -n )
ygemici
3
try like this
UNIX95=1 ps -ef -o pcpu,user,pid,args | /bin/sort -r|sed -n '1,12p'
delphys
4
UNIX95=1 ps -ef -o pcpu,user,pid,args | (head -n1; sort -r -k 1,1) | head -10
%CPU USER PID COMMAND
f /u1/rjl/db.pf -p gnpr/gnmenum -q -mmax 1024
16.66 progress 22668 /usr/dlc/bin/_progres -b -pf /u2/oms/bin/client/rjl/unixclnt.pf -p ommsgmon/msgmon.r
3.74 progress 7776 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2sm -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO88
3.62 progress 5009 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
3.59 progress 26837 /usr/dlc/bin/_proapsv -logginglevel 3 -logfile /u2/dba_logs/appserver/asrjl.server.log -ubpid 26097 -Ms 1 -logname asrjl -logen
3.45 progress 12908 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
3.42 progress 26097 /opt/java/jre/bin/IA64W/java -Xverbosegc1:file=/u2/dba_logs/appserver/gc/asrjl.gc.log -Xms32m -Xmx128m -Xss512k -classpath /u0/
3.32 progress 7746 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
3.27 progress 8741 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
Thank you very much but there seems to be an undesirable output line:
f /u1/rjl/db.pf -p gnpr/gnmenum -q -mmax 1024
I think this is the very last line from the original command .. any idea as to how to suppress it ??
Thnx again !!