Python's simplicity philosophy
bignose-hates-spam at and-benfinney-does-too.id.au
Thu Nov 20 23:00:14 CET 2003
On 20 Nov 2003 16:25:08 +0100, Curt wrote:
> Erik Max Francis <max at alcyone.com> writes:
>> [Unix command] 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
> curty at einstein:~$ uniq uniq.txt
> curty at einstein:~$ sort uniq.txt | uniq
> Maybe my uniq is unique.
> curty at einstein:~$ man uniq
> uniq - remove duplicate lines from a sorted file
I suspect your uniq is not unique; merely poorly documented. Pass it a
file consisting of unsorted input, but multiple consecutive identical
lines; you should see them collapsed to one.
Your OS needs a better 'man uniq', since that description doesn't say
what the expected behaviour is with unsorted input. The GNU 'man uniq'
doesn't mention sorted input, but applies to any input.
\ "Theology is the effort to explain the unknowable in terms of |
`\ the not worth knowing." -- Henry L. Mencken |
Ben Finney <http://bignose.squidly.org/>
More information about the Python-list