I tried each of these suggestions and neither worked.
Results:
#egrep -cv '#|^$' active_servers
this displayed the total but on screen only, not in the file
#awk '!/^#/ && !/^$/{c++}END{print c}' active_servers
same as above
#awk '!/^[ \t]*(#|$)/ {c++; ct++} /#/ && c { printf "%s\n\n\n%s", c, $0; c=0} END { print ct}' active_servers
awk: syntax error near line 1
awk: bailing out near line 1
To provide more detail, I have a script that produces the output above (in my original post) to a file - less the totals that I am seeking help with. When I refer to comments, I mean lines that are preceded with ## and the sections are separated with a blank line as a result of this "
sed '/this/{x;p;x;}'" in my script.
Thanks again! More suggestions would be welcome!