Count certain lines

Hi!
I have a file that looks like this:

AAG
[ 1 to 3 ]
[ 38 to 40 ]
[ 106 to 108 ]
----------------------------------------------------------------------
Number of residues in the repeat = 3
AGA
[ 23 to 25 ]
----------------------------------------------------------------------
Number of residues in the repeat = 3
AGG
[ 14 to 16 ]
[ 161 to 163 ]
[ 164 to 166 ]
[ 185 to 187 ]
----------------------------------------------------------------------

And so on. I was wondering if there's a way to count the number of lines starting with [ between each ---- separator. I mean, I'm not interested in getting the TOTAL number of lines starting with [, but getting an ouput like this:
3
1
4

Thanks! :o

awk '/^\[/{s+=1;next}{if (s!=0) print s;s=0}' file
1 Like

No words to thank you. Nice job!