Python's simplicity philosophy

Curt curty at freeze.invalid
Thu Nov 20 10:25:08 EST 2003


Erik Max Francis <max at alcyone.com> writes:

> Aahz wrote:

> > Huh?!?!  uniq has always to my knowledge only worked on sorted input.
> > Reading the man page on two different systems confirms my knowledge.

> uniq doesn't care whether the input is sorted or not.  All it does is
> collapse multiple consecutive duplicate lines into a single line.  Using
> uniq in conjunction with sort is certainly a common mode, but it's
> hardly required.

curty at einstein:~$ less uniq.txt
flirty
curty
flirty
curty

curty at einstein:~$ uniq uniq.txt
flirty
curty
flirty
curty

curty at einstein:~$ sort uniq.txt | uniq
curty
flirty

Maybe my uniq is unique.

curty at einstein:~$ man uniq

NAME
       uniq - remove duplicate lines from a sorted file
                                            ******





More information about the Python-list mailing list