in reply to Re: removing non-duplicates
in thread removing non-duplicates

although sort file | uniq works; why not just use...
sort -u

One world, one people

Replies are listed 'Best First'.
Re^3: removing non-duplicates
by davidrw (Prior) on Jul 12, 2005 at 12:53 UTC
    beacause that doesn't do what OP wanted. Quotes from the respective man pages:
    • sort: -u does output only the first of an equal run (which means all distinct rows)
    • uniq: -u does only print unique lines (which means all rows that appear exactly once)
    [me@host tmp]$ cat /tmp/t A B A C [me@host tmp]$ sort -u /tmp/t A B C [me@host tmp]$ sort /tmp/t | uniq -u B C