title: Bash grep IP from command output
body: <p>I'm working with fleetctl and kubectl and would like to extract an IP from <code>kubectl get pod app-etcd</code>:</p>
  
  <pre><code>POD        IP           CONTAINER(S)   IMAGE(S)                     HOST                               LABELS          STATUS    CREATED   MESSAGE
  app-etcd   10.10.0.1                                               k8s-socius-node-1/100.100.100.100   name=app-etcd   Running   3 days    
                          app-etcd       xyz/etcd-discovery                                                      Running   3 days
  </code></pre>
  
  <p>The closest I got to get the IP address is:</p>
  
  <pre><code>kubectl get pod app-etcd | grep -Eo '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
  </code></pre>
  
  <p>But this gives me both IP addresses (10.10.0.1 and 100.100.100.100); I only want/need the first one to run <code>sed</code> over a config file afterwards.</p>
  
  <p>How do I get only the first address to store it in a variable for further processing?</p>