[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort's -u is Failing to Check all -k fields for Uniqueness.
From: |
Ralph Corderoy |
Subject: |
Re: sort's -u is Failing to Check all -k fields for Uniqueness. |
Date: |
Sat, 19 Aug 2006 15:36:47 +0100 |
Hi Eric and Andreas,
Andreas wrote:
> > $ echo 1/3,1/2,1/1,2/1 | tr , \\012 | sort -nu -t / -k 1,2
>
> There is only one sort key, which spans the first two fields of each
> line, and -n tells sort to only consider the numeric prefix of each
> key. If you want to sort on multiple keys you need to specify each
> key separately.
>
> $ echo 1/3,1/2,1/1,2/1 | tr , \\012 | sort -nu -t / -k 1,1 -k2,2
Thanks both of you, that's my problem. I was thinking `-n -k 1,10'
would sort on the first ten fields, numerically. Not take the first ten
fields and sort them as if they were one number. I don't think sort(1)
or the info doc. make this very clear, perhaps it could be improved?
Thanks again,
Ralph.