How do I get the last non-empty line using tail under Bash shell?
tail
For example, my_file.txt looks like this:
my_file.txt
hello
How about using grep to filter out the blank lines first?
grep
$ cat rjh 1 2 3 $ grep "." rjh | tail -1 3