#!/usr/bin/gawk -f BEGIN { IGNORECASE=1; FS=","} /@attribute/ { A++ } /@relation/,/@data/ { next } NF==A { N++ } END { print N }