[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: uniq with sort-like "--key" support (now with sort and join)
From:       Assaf Gordon <assafgordon () gmail ! com>
Date:       2013-02-14 0:43:15
Message-ID: 511C3323.9000407 () gmail ! com
[Download RAW message or body]


More updates:
The attached patch converts 'sort' and 'join' to use the key comparison functions in \
'key-spec-parsing.c'.

Sort was straight-forward (as expected), mostly removing the duplicated code and \
moving some more functions to key-spec-parsing.c.

Join required a bit of trickery (explained in the code), the main change is the \
'keycmp()' function that now calls "keycompare()".

All tests pass for sort and join, but I suspect the join test-suite is not \
exhaustive.

Join definitely needs more testing, but one immediate feature is join in reverse \
order (which already works): ===
##
## Input files
##
$ cat j3.in 
C 1
B 2
A 3
$ cat j4.in 
C 9
A 8

##
## Existing join
##
$ join -a 1 -a 2 -o auto -e . -j1 j3.in j4.in 
C 1 9
A . 8
B 2 .
join: j3.in:3: is not sorted: A 3
A 3 .

##
## new Join reverse
##
$ ./src/join --reverse -a 1 -a 2 -o auto -e . -j1 j3.in j4.in 
C 1 9
B 2 .
A 3 8
===


Regards,
 -gordon


["uniq_key6.patch.xz" (application/x-xz)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic