[REBOL] Re: Sort by first part of line
From: al:bri:xtra at: 7-Sep-2002 23:29
With Carl's script:
data1: %test.txt
data2: %Sorted.txt
t: now/time/precise
file-index: copy []
file: open/lines data1
forall file [
append file-index reduce [copy/part file/1 4 index? file]
]
close file
sort/skip file-index 2
file: open/lines data1
foreach [code line] file-index [
write/append/lines data2 file/:line
]
close file
print now/time/precise - t
halt
I get this:
0:00:10.125
proving Carl's right:
> I expect it's slower than loading the whole file into memory, but might be
better for super-huge files...
Andrew Martin
ICQ: 26227169 http://valley.150m.com/