<p>I'm running the following command from Terminal to retrieve the status of a specific pod amongst all of my namespaces. The problem I'm trying to solve is to only return the <strong>unique</strong> namespaces that have a status of 'Evicted'</p>

<pre><code>kubectl get pods --all-namespaces -lapp=myapp | grep Evicted | sort | uniq -c
</code></pre>

<p><strong>This is an example of the results I get:</strong></p>

<pre><code>NAMESPACE       READY       STATUS
customer-1       0/1        Evicted
customer-3       0/1        Evicted
customer-2       0/1        Evicted
customer-3       0/1        Evicted
customer-1       0/1        Evicted
</code></pre>

<p><strong>This is the result I'm after:</strong></p>

<pre><code>NAMESPACE       READY       STATUS
customer-1       0/1        Evicted
customer-2       0/1        Evicted
customer-3       0/1        Evicted
</code></pre>

<p>How would I go about achieving this?</p>

dfuentes
<pre><code>kubectl get pods --all-namespaces -lapp=myapp | grep Evicted | awk {'print $1'} | uniq -c
</code></pre>

<p>should do the trick for you. Uniq wasn't having an effect because of non-unique pod names. </p>
