Awk

From Blue-IT.org Wiki

empty lines

count

awk 'NF{c++}END{print c}' file

remove

awk 'NF' file

see: [1]