Code:
gawk -F, 'BEGIN {count=0} {if ($4 > 50) count++ } END {print count}' filename
will print the total number of people older than 50. If you want to print also their Name, you can try
Code:
gawk -F, 'BEGIN {count=0} {if ($4 > 50) {count++ ; print $1}} END {print count}' filename
or to print on one line
Code:
gawk -F, 'BEGIN {count=0} {if ($4 > 50) {count++ ; people[count]=$1}} END {printf "%d ",count ; for (i in people) printf "%s ",people[i]; printf "\n"}'