[REBOL] Re: Sorting non-REBOL data
From: henrikmk:gma:il at: 1-Mar-2010 17:50
On Mon, Mar 1, 2010 at 5:22 PM, Steven White
<swhite-ci.bloomington.mn.us> wrote:
> I have to create a text file of 49-byte records (lines) in a fixed format, to create
an interface between two systems. =A0I build it in memory and it looks like the sample
below.
>
> 122998 720095 100109 00006000 3 =A0 ACH
> 123472 541099 100109 00050216 1 =A0 201
> 123473 541099 100109 00047164 1 =A0 201
> 123534 527401 100109 00000777 1 =A0 201
> 123593 527401 100109 00024206 1 =A0 201
> 123606 548187 100109 00009111 0 =A0 COUPON ONLY
> 123611 548187 100109 00005221 0 =A0 COUPON ONLY
> 123638 551670 100109 00352098 1 =A0 101
>
> Before I write it to disk, I want to sort it on that first six-digit number in positions
1-6. =A0I looked up the documentation of "sort" and thought that the "skip" option is
used for fixed-format lines, with the number after the data name being a number that
indicates the size of the line. =A0So I coded:
>
> sort/skip PYIMPORT-FILE 49
>
> The script returns a message of "Invalid argument: 49."
>
> Is it possible to sort a fixed-format text file of non-REBOL data?
If you can do this _before_ formatting it as a fixed file, put the
data in a block. Then you are able to sort it using /skip, /all and
/compare.
--
Regards,
Henrik Mikael Kristensen