I am overwhelmed by the high quality of responses (nearly 20!) in general the solution is to strip the "%" character so the comparison is numerical to numerical. the % makes it a string on one side of the equation. Michael Maciolek & John Sellin also showed me how to eliminate the egrep -v with sed -n to only print the % lines but delete the % itself. This worked for me: $ prstat -s cpu -n 10 2 1 |sed -n 's/%//p' |awk -F" " '($9 > 20) {print $0}' Though I admit I think in "grep" more easily than I think in sed! Other approaches suggested: - resource control or scheduler change - nagios plugin for just this application called "check_proc" - Perl based RegExs to accomplish same - gawk/nawk sub- based RegExs to accomplish same Thanks folks, this has gone in my permanent bag of tricks JV711 Individual thanks to Brad Morrison, Thomas M. Payerle, Daniel Denes, Doc G, Andy Harrison Dheeraj Soni, Hutin Bertrand, Peter Ondruska, John Hallman, Crist Clark, John Leadeham, Steve Harris, "Sandwich Maker", Oscar del Rio, Michael Maciolek, John Sellin, francisco, Rohit Srivastava, and Mark Scarborough. original question posted below: ---------- OK, it's NOT Solaris per se, but scripting and awk I have a problem with: can you help or point me towards another resource? consider the awk statement where $9 is greater than the threshold, I print the entire line: root@gumby prstat -s cpu -n 10 2 1 | egrep -v "NICE" | awk -F" " '($9 > "20%") {print $0}' 701 root 1047M 911M sleep 59 0 2:18:36 9.8% java/62 What I am trying to accomplish is to catch a java process that goes haywire and consumes more than 40% of the cpu and makes the box crawl for interactive users. sometimes prstat prints the results as a whole number like "20%" and sometimes it prints a decimal like "1.5%" or "0.3%". The awk -F" " '($9 > "X%") produces unpredictable results. Anyone have a technique or work around for normalizing the X% to a consistant format? Does gawk have better ">" operations? Kind regards JV711 Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Mon Nov 13 12:31:04 2006
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:02 EST