In count (non-blank) lines-of-code in bash they explain how to count the number of non-empty lines.
But is there a way to count the number of blank lines in a file? By
One way using grep:
grep
grep -c "^$" file
Or with whitespace:
grep -c "^\s*$" file