Maybe what I say below helps:
Russell [EMAIL PROTECTED]
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 21, 1999 8:40 PM
Subject: [REBOL] finding, then using it..
> hey guys,
>
> I have trouble with the simplest stuff.
>
> How can I find the last occurance of a word in a file, then give that as
> a value of a word? like,
>
> read %file find/last "fred"
Are you trying to find the last "fred" in a file that contains more than one
"fred" ?
Of course you could assign caveman the value "fred" without even looking at
the file, so I guess
you're trying to do something other than that.
Anyhow: here's one way, based on finding the last occurence of "cons" in the
file %christmas.r which "Bo" posted on this list recently.
>> caveman: first parse copy find/last read %christmas.r "cons" none
== "cons"
>> caveman
== "cons"
To understand how this works, try
>> s: find/last read %christmas.r "cons"
s will refer to the entire text with the index pointing to the last "cons",
actually to "{cons"
'copy, as someone else pointed out earlier, gets rid of the text before the
index point and includes only the text following it.
'parse -------- none returns a block of individual words as strings,
eliminating the leading "{"
'first gets the first word in that block.
Remember, 'word is a convention in this list for referring to a REBOL word,
word.
I got help from others' contributions.
Now tell us what you're really trying to do and perhaps we can help more!
> caveman: fred
>
> what I've tried has not worked for me.
>
> thanks!
> --
>
>
> -t
>
>