[REBOL] Re: UNIX-style sort command?
From: agem:crosswinds at: 27-Apr-2001 4:24
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 23.04.01, 20:44:54, schrieb Martin Middleton
<[martin--middleton--speechworks--com]> zum Thema [REBOL] UNIX-style sort
command?:
> Anyone written a file sorting utility that works similarly to UNIX?
> Specifically, I have a data file with a number of white space
separated
> columns. I'd like to be able to sort the file based on the different
> columns. I'd also like to be also to sort using numeric order. I've
tried a
> few things, but I'm sure I'm making this much more difficult that it
really
> is using REBOL. (Read: over thinking the solution. Hey, these paradigm
> shifts take time to sink in. ;)
if you are shure all lines have the same number of columns,
you could [parse my-var »the-split-char«]it,
then putting all in one big block and use 'sort/skip with all its nice
options.
Oh yes, and put the original string after the parts,
so you can extract the stuff with
[forskip sortet-block num-of-cols+original[
append out-lines sorted-block/index-of-original-line
]
hm. you should put only the interesting cols in the block,
if you add the original for exstraction..
Volker