[REBOL] Re: Creating a list, writing it in a file
From: carl:cybercraft at: 12-Apr-2002 9:40
On 12-Apr-02, COFFRE Richard FTO wrote:
> Hi Carl,
> Some details, my purpose is to create a list while reading lines in
> a file, then to sort the list and finally to copy it in a new file
> so first I have to extract the lines to create the list, I don't
> have it.
Well, would this work...
a-list: read/lines %original-file.txt
new-list: sort a-list
write/lines %new-file.txt new-list
If not, then there's something I'm not understanding...
Hmmm. Unless you want to read a line in at a time for some reason?
In that case, open a port for reading your file. ie...
a-port: open/lines %original-file.txt
You can then access the file via the port as if it was a normal
a-list: copy  ; Block to put lines in.
forall a-port [
append a-list first a-port
Then close the port...
The lines will now be in the a-list block and can be sorted and saved
as with my first example.
> What's the weather like in New Zealand ?
A bit grey this morning...