title: How to check if the variable value in AWK script is null or empty?
body: <ol>
  <li>I am using <strong>AWK</strong> script to process some logs.</li>
  <li>At one place I need to check if the variable value is <strong>null</strong> or <strong>empty</strong> to make some decision.</li>
  </ol>
  
  <p>Any Idea how to achieve the same? </p>
  
  <pre><code>awk '
  
  {
      {
         split($i, keyVal, "@")
         key=keyVal[1];
         val=keyVal[2];
         if(val ~ /^ *$/)
         val="Y";
  
      }
  
  }
  
  ' File
  </code></pre>
  
  <p>I have tried with </p>
  
  <pre><code>1) if(val == "")
  
  2) if(val ~ /^ *$/)
  </code></pre>
  
  <p>not working in both cases.</p>