#! /bin/csh -f

set tmp = "/tmp/$$.wfreq"

/bin/sort \
  > ${tmp}

set TOT = "`cat ${tmp} | /bin/wc -l`"

/bin/cat ${tmp} \
  | /bin/uniq -c \
  | /bin/sort -nr \
  | /usr/bin/expand \
  | /usr/bin/gawk \
      ' { printf "%6d %4.2f %s\n", $1, $1/'"${TOT}"', $2 }' 

echo " ----- ---- ----"
/usr/bin/printf "%6d 1.00 TOT\n" "${TOT}"

/bin/rm ${tmp}
