title: Extract particular value from column and exit from loop
body: <p>I want to extract column dispstatus from below command and if all the entries are GREEN then i should come out of the loop.</p>
  
  <pre><code>sapcontrol -nr 01 -function GetProcessList
  
  17.02.2020 01:40:34
  GetProcessList
  OK
  name, description, dispstatus, textstatus, starttime, elapsedtime, pid
  disp+work, Dispatcher, GREEN, Running, 2020 02 16 03:50:28, 21:50:06, 59404
  igswd_mt, IGS Watchdog, GREEN, Running, 2020 02 16 03:50:28, 21:50:06, 59405
  gwrd, Gateway, GREEN, Running, 2020 02 16 03:50:30, 21:50:04, 59423
  icman, ICM, GREEN, Running, 2020 02 16 03:50:30, 21:50:04, 59424
  </code></pre>
  
  <p>For now i have used below command where instead of getting all the values i'm checking the counts of GREEN and exiting which is currently not what i intend to do. Can you please help me?</p>
  
  <pre><code>while true ; do status=`sapcontrol -nr 01 -function GetProcessList |awk -F ',' '{if ($3) print $3;}'|grep -i GREEN | wc -l`; sleep 2; if [[ $status -ge 2 ]]; then break ;fi; done
  </code></pre>
  
  <p>EDIT: some command in different lines.</p>
  
  <pre><code>while true ; do
     status=`sapcontrol -nr 01 -function GetProcessList |
        awk -F ',' '{if ($3) print $3;}'|
        grep -i GREEN |
        wc -l`
     sleep 2
     if [[ $status -ge 2 ]]; then
        break
     fi
  done
  </code></pre>
  
  <p>Thanks,
  Anup</p>