![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare columns from seven files and print the output | smriti_shridhar | Shell Programming and Scripting | 7 | 06-10-2008 09:22 PM |
| Compare 2 files and give uniq output | rauphelhunter | Shell Programming and Scripting | 1 | 05-12-2008 01:47 PM |
| compare two col from 2 files, and output uniq from file 1 | pp56825 | Shell Programming and Scripting | 2 | 01-10-2008 07:10 AM |
| Aggregate values in a file & compare with sql output | shiroh_1982 | UNIX for Dummies Questions & Answers | 1 | 09-02-2007 04:40 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Compare output from awk to a value
I need to write a shell script which checks the CPU utilization is above 90% for a particular process.
So far I have done this prstat 0 1 | grep weblogic | awk '{print $9}' This give an output like this 0.1% 0.0% 0.0% 0.0% 0.0% Now I need to assign this to an array and check if the value exceeds 90%. If so then I should print an alert message in the script. Please help me to do the same. Thanks Joe |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
assuming single precision, Code:
prstat 0 1 | grep weblogic | awk '{print $9}' | sed 's/%//' | while line do
if [ `echo $line \* 10 | bc` -gt 900 ]
then
echo "$line greater than 90"
else
echo "$line not greater than 90"
fi
done
|
|
||||
|
Quote:
|
|
|||
|
Quote:
i just made a quick glance at the output of the command and hence restricted it to single precision |
|||
| Google UNIX.COM |