<p>I am running below command in openshift platform which produces some output</p>
<p>oc get pods</p>
<p>name  status</p>
<p>job1  Running</p>
<p>job2  Completed</p>
<p>How to extract only status from the above result and store it in a variable using shell script.</p>
<p>ex : status=completed</p>

Prabhakar
<blockquote>
<p>How to extract only status from the above result and store it in a
variable using shell script.</p>
<p>ex : status=completed</p>
</blockquote>
<p>Try <code>status=$(oc get pods -o=custom-columns=STATUS:.status.phase --no-headers)</code>. You can <code>echo $status</code> and see the list of status saved in the environment variable.</p>
