prstat

hi all,
am writing a ksh script on solaris 9 to get the number of threads taken by a process. am using the prstat -p command to do this.

output i get is :

[server:user]:"/export/home/user" > prstat -p 25528 | cut -f2 -d/
NLWP
203
Total: 1 processes, 203 lwps, load averages: 2.58, 3.24, 3.62
NLWP
203
Total: 1 processes, 203 lwps, load averages: 2.71, 3.25, 3.62

how do i grep the actual number i.e 203 ?? and how do i exit or stop the prstat process after i have gotten the number ??

thanks in advance.

You can specify an interval and count on the end of the prstat command-line, however an easier way to do this would be:

ps -o nlwp -p <pid> | tail -1

ah this command is much better.thanks a million :slight_smile: