command for counting number of active cron jobs in crontabs

You need to delete everything that does not start with a digit (the minute). But to get that, remove any leading whitespace first. This will get rid of comments, blank lines, variable assignments, etc.

crontab -l 2>/dev/null | sed 's/^ *//;/^[*@0-9]/!d' | wc -l

Why remove characters? Try the following:

$ crontab -l | grep -c "^[0-9*]"

crontab -l | grep -v '^#'

Simple.

The number?

crontab -l | grep -v '^#' | wc -l

or

crontab -l | grep -c -v '^#'

(last one inspired by an answer here).

This will give you the (number of) scheduled cron jobs, not the active cron jobs, which could mean the jobs that are currently running.