#!/usr/bin/gawk -f # class - The class to get the count of BEGIN{ FS=OFS=","; IGNORECASE = 1; d = 0; class="true"; } d == 1{ if ( NF > 0 ) classes[$NF]++; } /@data/{d=1;} END{ print classes[class]; }