UNIX command to count blank lines in a file in DOS format

Hi Team,

The content of the file is as follows.

asdf
234
asdf

asdf
dsfg
gh

67
78

The file is in DOS format (not in Unix Format). The file is transferred to Unix. I need a unix command to check the number of blank lines in a input (comming from Windows). If it is greater than 0, then invalid file else valid file.

Please note I have tried the following command. It will work if the file is in Unix format else it will not work.

grep ^$ filename |wc -l 

Can anyone help me out to resolve this issue.

Thanks
krishnakanth

Try:-

grep -v "^[a-zA-Z0-9]" filename |wc -l

OR

grep "^[[:cntrl:]]" filename | wc -l

Or you can try:

 awk '/^\r/{c++}END{print c}' file 

try also:

awk 'END {print NR-1}' RS= infile

You can adapt your own command:

$ grep ^^M$ file|wc -l
2