title: How to use word boundary in awk when using data from variable
body: <p>I have problem with word boundary in <code>awk</code></p>
  
  <pre><code>var="blue"
  </code></pre>
  
  <p>
  
  <pre><code>cat file
  test
  blue more
  bluegrass not
  yes red
  more blue
  fine blue, not
  </code></pre>
  
  <p>I need only lines with  <code>blue</code>, more or less.</p>
  
  <p>If I do:</p>
  
  <pre><code>awk '/\&lt;blue\&gt;/' file
  blue more
  more blue
  fine blue, not
  </code></pre>
  
  <p>I get the output what I need (but this is without using variable).</p>
  
  <p><br>
  But how to do this with a variable?</p>
  
  <p>Here are some of my tests:</p>
  
  <pre><code>awk '$0~"\&lt;"test"\&gt;"' test="$var" file
  awk '$0~/\&lt;/test/\&gt;/' test="$var" file
  awk '{a="\&lt;"test"\&gt;"} $0~a' test="$var" file
  </code></pre>
  
  <p>All of these fails.</p>
  
  <p>Needs <code>awk</code> only, since this is part of a larger test.</p>
  
  <hr>
  
  <p>Update.<br>
  It seems that some of my variable does contains a <code>+</code> sing. This brakes the solution from <code>Ed</code></p>
  
  <pre><code>var="blue+"
  </code></pre>
  
  <p>
  
  <pre><code>cat file
  test
  blue+green more
  bluegrass not
  yes red
  more blue+
  fine blue+, not
  </code></pre>
  
  <p>
  
  <pre><code>awk -v test="$var" '$0~"\\&lt;"test"\\&gt;"' file
  blue+green more
  more blue+
  fine blue+, not
  </code></pre>