How to get the line non-empty of a file using tail ? Bash

Posted by debugger on Stack Overflow See other posts from Stack Overflow or by debugger
Published on 2010-04-14T15:52:08Z Indexed on 2010/04/14 15:53 UTC
Read the original article Hit count: 163

Filed under:
|
|
|
|

Do you have an idea how to get the last line non-empty using tail in bash ?

For example my_file.txt will be as following:

hello
hola
bonjour
(empty line)
(empty line)

Obviously if i do tail -n 1 my_file.txt i will get an empty line. In my case i want to get bonjour

Any clues?

Thanks

Debugger

© Stack Overflow or respective owner

Related posts about tail

Related posts about bash