title: sed - How to extract IP address using sed?
body: <p>This is for an assignment so I have no choice but to use sed.</p>
  
  <p>Given a file <em>messages</em>, how can I extract all the IP addresses and print them? </p>
  
  <p>I first tried</p>
  
  <pre><code>sed -n '/((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])/p' messages
  </code></pre>
  
  <p>But it printed nothing. After doing some research, I found out that sed does not support non-greedy operators like ? and |. </p>
  
  <p>I've been wracking my brain but I can't think of a way to do this without the non-greedy operators. How can I do this?</p>