title: AWK: What is the regular expression to match any string?
body: <blockquote>
    <p>I assume the regular expression would be the same in any case (eg:
    <code>grep</code>), but I am testing this using <code>awk</code>.</p>
  </blockquote>
  
  <p>Case <strong>example</strong>:</p>
  
  <pre><code>$ cat Test.csv
  2018-03-31,22:39,Test,2,4,2
  2018-03-31,22:40,Test02,2,4,2
  2018-03-31,22:40,Test03,2,4,2
  2018-03-31,22:40,Test04,2,4,2
  2018-03-31,22:59,Test03,5,4,2
  2018-03-31,23:00,Test07,6,4,2
  2018-03-31,23:00,Test08,2,2,2
  </code></pre>
  
  <p>I would like to know how to <strong>match any value</strong> (any string) at, say, field 3:</p>
  
  <pre><code>$ awk -F ',' '$3 == *' Test.csv
  awk: syntax error at source line 1
   context is
          $3 == &gt;&gt;&gt;  * &lt;&lt;&lt;
  awk: bailing out at source line 1
  </code></pre>
  
  <p>-</p>
  
  <pre><code>$ awk -F ',' '$3 == .*' Test.csv
  awk: syntax error at source line 1
   context is
          $3 == &gt;&gt;&gt;  . &lt;&lt;&lt; *
  awk: bailing out at source line 1
  </code></pre>
  
  <p>-</p>
  
  <pre><code>$ awk -F ',' '$3 == /*/' Test.csv
  awk: illegal primary in regular expression * at
   source line number 1
   context is
          $3 == &gt;&gt;&gt;  /*/ &lt;&lt;&lt;
  </code></pre>
  
  <p>-</p>
  
  <pre><code>$ awk -F ',' '$3 == /.*/' Test.csv
  [No results]
  </code></pre>
  
  <p>-</p>
  
  <pre><code>$ awk -F ',' '$3 == /^*/' Test.csv
  [No results]
  </code></pre>
  
  <p>Even when there could be other methods to solve the problem, how can I <strong>match every possible string</strong> by using <strong>regular expressions</strong> at a specific field (CSV assumed) by using AWK?  </p>
  
  <p>If possible, it could be useful some method to include the NUL string (for empty fields like <code>2018-03-31,23:00,,2,2,2</code>) so AWK returns every line.  </p>
  
  <hr>
  
  <p><strong>Why do I need this</strong>?</p>
  
  <blockquote>
    <p>(upon requestion; a bit awkward to explain, sorry; only for those
    interested)</p>
  </blockquote>
  
  <p>Basically for code simplification (readability). My shell script is structured in a manner that I would prefer to execute the search like this:</p>
  
  <pre><code>awk -F ',' -v AL__AWK="$AL" -v VL__AWK="$VL" -v DL__AWK="$DL" -v Codigo__AWK="$Codigo" -v SubCodigo__AWK="$SubCodigo" '$4 == AL__AWK &amp;&amp; $5 == VL__AWK &amp;&amp; $6 == DL__AWK &amp;&amp; $8 ~ Codigo__AWK &amp;&amp; $9 ~ SubCodigo__AWK' "$LogFile"
  </code></pre>
  
  <p>As can be seen (er... or so I hope) the search for fields inside the CSV file is variable-based. Some of these variables are initialized with a specific value and some come from parameter input. So, having a generic "any string" value would prevent me from writing this AWK line in multiple different manners.</p>
  
  <p>I.E: Sometimes the script will receive the <code>Codigo=Ptt</code> value via input parameter , and some the <code>Codigo</code> variable will not be defined by parameter inputing; in this second case, I will do <code>Codigo=".*"</code>, so the above AWK line will still be valid.</p>
  
  <p>Sorry, but the complete explanation is very long.</p>