When you read a line with read/lines, the result is a block of string!.
So you are sorting string! "objects".
What you have to do in fact is to split the string and convert the first
member to date:
Here is a sample :

a: parse "1-Feb-2000 bla bla bla" none
reduce [ to-date first a second a third a fourth a]

I doesn't master Rebol enough yet to help you with the conversion of all the
lines of the files and for sorting.

Olivier.


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 10, 2000 11:44 PM
Subject: [REBOL] problem with sort a file Re:(2)


> Hi, Mike
> Thanks for your reply.
>
> I use /skip because I thought it is for sectional sorting. in my file,
each
> record has 4 sections(e.g, 1-Feb-2000  bla bla bla). I just tried without
skip,
> it gave me the same result though. I guess this is might because of I read
it
> from a file?
>
> I use the following script and sample file,
>
> file: read/lines  %foo.txt
> blk: make block! 100
> blk: to-block file
> file2: sort blk
> write/lines  %foo2.txt file2
>
> which foo.txt is:
> 2-Feb-2000  1   2
> 1-Feb-2000  2   1
> 6-Feb-2000  3   5
> 24-Feb-2000 4   6
>
> the result foo2.txt is:
> 1-Feb-2000  2   1
> 2-Feb-2000  1   2
> 24-Feb-2000 4   6
> 6-Feb-2000  3   5
>
> It can't tell 24-Feb-2000 is larger than  6-Feb-2000. Why is it?
>

Reply via email to