Shouldn't be to hard, but your going to have to write a shell script to do this. Assuming you always use closing tags for everything that has one, try this:
CountTags.ksh
#!/usr/bin/ksh -p
# Script designed to count opening tags and closing tags
FILE=$1
# C(number) stands for Count Variable
C1=`/usr/bin/grep "<HTML>" ${FILE}`
C2=`/usr/bin/grep "</HTML>" ${FILE}`
C3=`/usr/bin/grep "<HEAD>" ${FILE}`
C4=`/usr/bin/grep "</HEAD>" ${FILE}`
etc,etc
print "Count for <HTML> Tags: ${C1}."
print "Count for </HTML> Tags: ${C2}."
print "Count for <HEAD> Tags: ${C3}."
print "Count for </HEAD> Tags: ${C4}."
That should do what you want, you could probably put this into a for loop format so you wouldn't have to type out all of the variables. Maybe something like this:
FILE=$1
COUNT=1
# SOMENUMBER == # of Tags that you check for.
let SOMENUMBER=SOMENUMBER+1
while [ ${COUNT} -ne ${SOMENUMBER} ]
do
for VAR in HTML HEAD TITLE P BLOCKQUOTE (ETC,ETC)
do
C${COUNT}=`/usr/bin/grep "<${VAR}>" ${FILE}
let COUNT=COUNT+1
C${COUNT}=`/usr/bin/grep "</${VAR}>" ${FILE}
done
let COUNT=COUNT+1
done
Not sure if the second example will work right off the bat, may need some work, but the first one should be good to go.