The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-23-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline
Anomalous Lurker
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
Code:
uniq -c myfile.txt
yields:

1 123000
1 123001
1 123004
1 123005
2 123004
4 123008
1 246599
1 246700
5 246999
1 246888
1 246881
1 246999
1 357001
1 357888
8 357999

If you really need to have the results like:

357888 1
357999 8

you can use a simple awk script:

Code:
uniq -c myfile.txt | awk '{print $2, $1}'
Reply With Quote