title: awk -Search pattern through Variable
body: <p>We have wrote shell script for multiple file name search pattern.</p>
  
  <p><strong>file format:</strong> </p>
  
  <pre><code>&lt;number&gt;_&lt;20180809&gt;.txt
  </code></pre>
  
  <p>starting with <strong>single number</strong> and ending with <strong>8 digits</strong> number </p>
  
  <p><strong>Command:</strong></p>
  
  <pre><code>awk -v string="12_1234" -v serch="^[0-9]+_+[0-9][0-9][0-9][0-9]$" "BEGIN{ if (string ~/serch$/) print string }"
  </code></pre>
  
  <p>If sting matches then return value.</p>