Delete last blank line.

I need to delete the last line only if its blank not otherwise.

awk 'NR > 1{print t} {t = $0}END{if (NF) print }' file

Any sed variants ?

Try:

sed '${/^$/d}' file

---------- Post updated at 07:32 ---------- Previous update was at 07:24 ----------

or

sed '${/./!d}' file