One of the possible Ans is (Tested on Solaris it works)
Answer to your both Questions in single Scr!!!
#!/bin/sh
date > tempdate
temp=`awk '{print $2}' tempdate`;
rm tempdate;
echo $temp;
for var in $temp
do
grep -i $var myfile | wc -l;
done;
Replace <myfile> with your absolute file path and <wc -l> whatever like <sort> or anything