We have an input file as follows:
2010-09-15-12.41.15
2010-09-15-12.41.15
2010-09-15-12.41.24
2010-09-15-12.41.24
2010-09-15-12.41.24
2010-09-15-12.41.24
2010-09-15-12.41.25
2010-09-15-12.41.26
2010-09-15-12.41.26
2010-09-15-12.41.26
2010-09-15-12.41.26
2010-09-15-12.41.26
2010-09-15-12.41.28
2010-09-15-12.41.28
2010-09-15-12.41.28
2010-09-15-12.41.28
2010-09-15-12.41.41
And we have this loop which works fine to count and print the line recurrences, i.e.:
for i in `cat infile | uniq`
do
num=`cat infile | grep $i | wc -l`
echo $i $num
done
However, would like to use the awk program to perform the similar logic. Please assist if possible and thanking you in advance.