[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sort: Is this a bug or not?
From: |
Miklos Janosi |
Subject: |
Re: Sort: Is this a bug or not? |
Date: |
Wed, 06 Mar 2002 08:16:09 -0500 |
Paul Eggert wrote:
>
> OK, I see the problem now. The problem is that you (and I)
> misunderstood how `cut' operates. `cut -c4-6,1-3' is equivalent to
> `cut -c1-6'; it does not reorder columns. That is how traditional
> Unix `cut' works, and POSIX requires this behavior.
Many thanks to Paul Eggert for figuring this out!!!
This is how I checked that the sort worked:
cut -c3-14 xx > c1
cut -c32-35 xx > c2
cut -c26-31 xx > c3
cut -c15-25 xx > c4
paste -d'\0' c1 c2 c3 c4 | sort > yy
sort -t: -k1.3,1.14 -k1.32,1.35 -k1.26,1.31 -k1.15,1.25 -o xx xx
cut -c3-14 xx > c1
cut -c32-35 xx > c2
cut -c26-31 xx > c3
cut -c15-25 xx > c4
paste -d'\0' c1 c2 c3 c4 > zz
diff yy zz
-- ________________________
-- __ /|___ Two | |
-- | | / | wrongs | Miki Janosi |
-- _| |_ \ ___| won't | address@hidden |
-- \ / \| make a | (330) 972-8640 |
-- \ / ___|\ right. | |
-- \/ | \ /-----------------------/ |
-- |___ / \ 3 lefts will. \ _/
-- |/ `------------------------