title: pipe to less if input is not empty
body: <p>In an earlier question (<a href="https://stackoverflow.com/questions/21470992/use-awk-to-output-section-of-file-forward-and-back-from-target-regex">Use awk to output section of file forward and back from target regex</a>) I developed the following statement that pipes output from gawk into less.</p>
  
  <pre><code>gawk -v RS="${recordSetDelimiter}" "BEGIN{IGNORECASE=$ignoreCase} /${searchTerm}/{print FILENAME ORS \$0 ORS \"&lt;&lt;\"}" "${directory}"/*.idx | less -I -p "${searchTermLess}"
  </code></pre>
  
  <p>However, I want the ability to avoid less if the input is empty. I thought about variables or temp text files, and I guess this could work, but the input might be big and I am not sure how that would affect handling. (Since what I love about this command is just how quick it is.) </p>
  
  <p>Is there a "best way" to handle this? How to also handle input that is just empty lines?</p>