Unix script help

No, it still not working. I am going to attach the file and let you look in to this..my bottom line should be if any queue has curdepth more than 200 messages, I should get an email...

When I execute this:

awk -F'[()]' '/CURDEPTH/ && $4+0>200{exit 1}' a.out
echo $?

I get 0 . Do you get that too?

No, I am getting 0.

Yes I meant 0...
So if that is the case then you should not get a mail when you do:

awk -F'[()]' '/CURDEPTH/ && $4+0>200{exit 1}' a.out || mailx -s "There may be a problem with QM, Please check the queue depth" email address < test1.txt

I tried it again..Unfortunately, I am getting the email. :confused:

---------- Post updated at 04:41 PM ---------- Previous update was at 04:35 PM ----------

Oh, wait...I think something is working...I didn't get the email this time...

But, I changed the condition to

awk -F'[()]' '/CURDEPTH/ && $4+0>50{exit 1}' a.out || mailx -s "There may be a problem with QM, Please check the queue depth" email address < test1.txt

I still don't get the email..This time I am supposed to get an email because there are 77 messages waiting for one queue in a.out...

Good we are getting somewhere. Now try this alternative that takes into account your varying input file format..

awk '/CURDEPTH\(/{sub(/.*CURDEPTH\(/,x);sub(/\).*/,x);if($1>200) exit 1}' a.out || mailx -s "There may be a problem with QM, Please check the queue depth" email address < a.out

Sure..This works like a champ...

Thanks a lot for your help..

I think this will serve my purpose...