This is not a home solution. But I think I can give a few pointers.
One idea would be to create a counter, and then print the result at the end:
awk '<COND> {c++} END {print c}'
I am a little confused by the terminology. You first state that the lines should be counted, but the examples say that these lines should be printed.
Now, of course, you can do something like this:
awk '<COND>' file.txt | wc -l
, , wc -l, , .
, <COND>, . google awk, .