Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Help in unix script
Greetings all,
I need to do the following
unix> top -b -U norad
PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
12733 norad 1 60 2 3936K 3392K run 0:05 7.21% dbganlz 12747 norad 4 52 2 13M 10M sleep 0:05 4.20% dbgora 12721 norad 1 53 2 3160K 2584K sleep 0:00 0.12% dbgsam 12726 norad 1 52 2 3184K 2416K sleep 0:00 0.02% dbgalert 12740 norad 1 53 2 2992K 2128K sleep 0:00 0.02% dbgrepos 12594 norad 1 59 0 3200K 2544K sleep 0:00 0.01% dbgsam 12606 norad 1 59 0 4696K 4160K sleep 0:11 0.00% dbganlz 12620 norad 4 59 0 42M 13M sleep 0:06 0.00% dbgora 12599 norad 1 58 0 3216K 2400K sleep 0:00 0.00% dbgalert 12613 norad 1 59 0 3016K 2112K sleep 0:00 0.00% dbgrepos
I have to check the last character of SIZE column. If the size is in M(megabyte) then check if the value is > 40 then send an e-mail with the COMMAND name and the size. Something like "dbgora has a size of 42M"
I was trying the following script. But I am not sure how to get the last character of SIZE column from the above output and compare with 'M' and then compare with the value.
top -b -U norad | grep norad | awk '{ print $6, $11 }' | \
while read SIZE COMMAND
do
echo "Command : $COMMAND Size : $SIZE"
done
Any suggestions will be appreciated.
Thanks,
Ashoke
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Mandal, Ashoke
INET: ashoke.k.mandal_at_medtronic.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Mar 28 2002 - 10:28:20 CST