I'm trying to get the universities result data into different file, where the $9 contains unversity field and field7,4 & 5 contains the keys to sort the students by marks. How to use uni variable to match against $9 inside awk?
c=0
for uni in `cat /tmp/global_rank| awk -F ',' '{print $9}'|sort |uniq`
do
awk -F ',' -v 'VAR=$uni {
if ($9 == VAR)
print
}' /tmp/global_rank | sort -nr -t"," -k7,7 -k4,4 -k5,5 > /tmp/university_${c}.csv
c=`expr $c + 1`
done
Thanks for the help!