total number of lines

Hi have following file

|abcd
2|abcd
|sdfh
|sdfj

I want to find total number of files haivng nothing in feild 1 using awk

will command
awk -F "|" '( $1=="") {print NR}' test_awk

will work???

awk -F"|" ' $1 == "" { cnt++ ; } END { print cnt } ' file

good to know such command
can you explain about cnt

cnt is a variable.
$1 == "" { cnt++ ; }
cnt is incremented if the first field is null

You can also use grep :

grep -c '^|' file

Jean-Pierre.