title: How to filter output lines from bash command, based on dates in start of the line?
body: <p>I am getting following lines as an output of some bash pipe</p>
  <pre><code>output
  20200604_tsv
  20200605_tsv
  20200606_tsv
  20200706_tsv
  </code></pre>
  <p>I have a date variable in YYYYMMDD format in a variable</p>
  <pre><code>filter_date=&quot;20200605&quot;
  </code></pre>
  <p>I want to apply the date operation on the output lines i.e. pick lines only where line's first part (before '_') is less than equal to filter_date.</p>
  <p>i.e. Expected output</p>
  <pre><code>20200604_tsv
  20200605_tsv
  </code></pre>
  <p>How to achieve this filtering in bash pipe?</p>
  <p>I have tried following (lexicographically match the string) but not able to filter and get original names.</p>
  <pre><code>BASH_CMD_THAT_OUTPUT_LINES | sort | awk '{name = ($1); print name &lt;= &quot;20200605*&quot;}'
  
  ## Answer
  1
  0
  0
  0
  </code></pre>