how to using a variable in awk

view story

http://www.unix.com – Hello! The following is my script: Code: #!/bin/bash declare -a num num=($(awk -F, '!_[$2]++{print $2}' HB291-0W-A4.txt | sort  -k1.6n)) for f in HB291-0W-A4.txt   do   for ((i=0;i<=46;i++))       do         awk -F, -v numid=${num[i]} '/$numid/' $f > out.tmp         usage=($(awk -F, 'END{print NR}' out.tmp))         rm out.tmp         echo ${num[i]} $usage       done done What I want to do is count the times of each value in the column? A (HowTos)