title: How do I get the last non-empty line of a file using tail in Bash?
body: <p>How do I get the last non-empty line using <code>tail</code> under Bash shell?</p>
  
  <p>For example, <code>my_file.txt</code> looks like this:</p>
  
  <blockquote>
    <p>hello<br>
    hola<br>
    bonjour<br>
    (empty line)<br>
    (empty line)  </p>
  </blockquote>
  
  <p>Obviously, if I do <code>tail -n 1 my_file.txt</code> I will get an empty line. In my case I want to get <code>bonjour</code>. How do I do that?</p>