title: Extract a particular string from a file and output to another file using grep, awk, sed
body: <p>I have a file and it contain the ff strings</p>
  
  <pre><code>2013-09-08 21:00:54 SMTP connection from [78.110.75.245]:5387 (TCP/IP connection count = 20)
  2013-09-08 21:00:54 SMTP connection from [188.175.142.13]:34332 (TCP/IP connection count = 20)
  2013-09-08 21:45:41 SMTP connection from [58.137.11.145]:51984 (TCP/IP connection count = 20)
  2013-09-08 21:49:26 SMTP connection from [109.93.248.151]:22273 (TCP/IP connection count = 20)
  2013-09-08 21:49:27 SMTP connection from [37.131.64.203]:7906 (TCP/IP connection count = 20)
  </code></pre>
  
  <p>What I want to do is extract the IP address only and save it to a file.</p>
  
  <p>I started with this</p>
  
  <pre><code>sed '^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$' file &gt; ips
  </code></pre>
  
  <p>But I couldn't make it work.</p>