How do I get the last non-empty line of a file using tail in Bash? August 4, 2023 by Tarik Use tac, so you dont have to read the whole file: tac FILE |egrep -m 1 .