The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-21-2008
shantanuo shantanuo is offline
Registered User
  
 

Join Date: Aug 2008
Location: Mumbai
Posts: 79
Compare array values

# tail myprocesses.txt
178 processes at Tue Oct 21 14:33:01 IST 2008
16 MySQL processes at Tue Oct 21 14:33:01 IST 2008
175 processes at Tue Oct 21 14:36:01 IST 2008
60 MySQL processes at Tue Oct 21 14:36:01 IST 2008
192 processes at Tue Oct 21 14:39:01 IST 2008
64 MySQL processes at Tue Oct 21 14:39:01 IST 2008
178 processes at Tue Oct 21 14:42:01 IST 2008
67 MySQL processes at Tue Oct 21 14:42:01 IST 2008
176 processes at Tue Oct 21 14:45:01 IST 2008
68 MySQL processes at Tue Oct 21 14:45:01 IST 2008

# tail myprocesses.txt | grep -i 'mysql processes' | awk '{print $1}'
16
60
64
67
68

I want to compare the above values and if all of them are more than 50 then echo "Problem". In the above mentioned case, it will not echo "Problem" because first value i.e. 16 is less than 50