title: Grep an IP with exact match and match between random string
body: <p>I'm trying to display the following input file containing IP address. I want to display the exact match between string as shown in example but doesn't seems to success. For demonstration here is example data inside a text file called <code>input.txt</code>:</p>
  <pre><code>1. IP [1.1.1.1] 
  2. IP [1.1.1.11] 
  3. IP [1.1.1.115]
  4. IP &quot;1.1.1.1 &quot; 
  5. IP &quot;1.1.1.11 &quot;
  6. IP &quot;1.1.1.115&quot;
  7. IP U*@K1.1.1.1-I(M@ 
  8. IP *JJ1.1.1.11()
  9. IP *J@K1.1.1.115U*@ 
  10. IP U#@I1.1.1.19lds
  </code></pre>
  <p>So, let say I want to find this IP: <code>1.1.1.1</code>, I will write the following code:</p>
  <pre><code>grep -w '1.1.1.1' input.txt
  </code></pre>
  <p>With this I got the following output:</p>
  <pre><code>1. IP [1.1.1.1]
  4. IP &quot;1.1.1.1 &quot;
  </code></pre>
  <p>But the expected output is, the 7th line also should display because it contains the IP of <code>1.1.1.1</code> between a random string. So expected output should be like this:</p>
  <pre><code>1. IP [1.1.1.1]
  4. IP &quot;1.1.1.1 &quot;
  7. IP U*@K1.1.1.1-I(M@
  </code></pre>
  <p>And now let say I want to find this string: <code>1.1.1</code>:</p>
  <pre><code>grep -w '1.1.1' input.txt
  </code></pre>
  <p>and I got the following output:</p>
  <pre><code>1. IP [1.1.1.1]
  2. IP [1.1.1.11]
  3. IP [1.1.1.115]
  4. IP &quot;1.1.1.1 &quot;
  5. IP &quot;1.1.1.11 &quot;
  6. IP &quot;1.1.1.115&quot;
  7. IP U*@K1.1.1.1-I(M@
  </code></pre>
  <p>The expected output is, it shouldn't return anything because the whole string <code>1.1.1</code> is not inside <code>input.txt</code>.</p>
  <p>Is grep capable of doing this ?</p>