I have a text file which contains about 50MB of text:
valA
valB
valC
valZ
valB
Whats the quickest way to:
- cat the file
- Display the unique appearences
|
One way using
Results:
Food for thought:
|
|||
|
|
|
notice valB is not unique here. Edit How could I miss there is -u for uniq: |
|||
|
|
sortfirst, then calluniq. Useless use of cat. Try:< text.txt sort -n | uniq -c– Suicidal Steve Sep 14 '12 at 0:30sort -u text.txt? If counts are wanted, thensort text.txt | uniq -cworks, optionally followed bysort -nto put the lines into frequency order. – Jonathan Leffler Sep 14 '12 at 0:31uniqworks sanely. The input clearly isn't sorted. – Jonathan Leffler Sep 14 '12 at 0:32