Help with uniq command

I call....

cat 1.txt | uniq -c

Sample of whats in 1.txt

vmstat
cd
exit
w
cd
cd
cd
newgrp
xinit
f
cd
cd
cd
rlogin
rlogin
cd
cd
cd
rlogin
rlogin

On a file but the output is not really "unique". I want all the output to be just each word with the number of times beside it, but I get this....

 2 cd
      1 lp
      4 exec
      1 cd
      1 f
      2 cd
      1 w
      1 vmstat
      1 qu
      2 exec
      1 cd
      1 exit
      2 exec
      1 pwd
      1 vmstat
      1 cd
      1 exit
      1 w
      3 cd
      1 newgrp

Help?

sort 1.txt | uniq -c

UUOC

The input to uniq must be sorted. It only deals with consecutive duplicate lines.

This awk script will do it without sorting:

awk '
{
 ++count[$0]
 line[NR] = $0
}
END {
while ( ++n <= NR ) {
   if ( x[line[n]]++ == 0 ) printf "%7d %s\n", count[line[n]], line[n]
  }
}
' "$FILE"