I want to loop
[1/10] from: john:thousand-hills at: 2-Sep-2001 23:57
I have files that I would like to start the following script on line 7 of
the file and loop until the lines run out. The input is done in lines, so
the loop would read line 7, line 8, etc.. until the lines stop.
Any suggestions?
d7: pick data 7 either d7 [ print makerow d7 ][ "" ]
-----------------------
John
[2/10] from: arolls:bigpond:au at: 3-Sep-2001 20:15
How about
data: read/lines %file.txt
n: 7
while [n <= length? data][
probe data/:n
n: n + 1
]
[3/10] from: petr:krenzelok:trz:cz at: 3-Sep-2001 12:44
Anton wrote:
> How about
> data: read/lines %file.txt
<<quoted lines omitted: 3>>
> n: n + 1
> ]
data: read/lines %file.txt
data: skip data 6
foreach line data [print line]
-pekr-
[4/10] from: john:thousand-hills at: 3-Sep-2001 5:56
Anton:
Where and how do I alter my line of code to function in the loop?
print makerow n: ? but where is it placed?
//john
At 08:15 PM 9/3/2001 +1000, you wrote:
[5/10] from: allenk:powerup:au at: 3-Sep-2001 21:27
If you don't need to keep track of line numbers, 'foreach would be quicker
than using 'while
data: skip read/lines %lines.txt 6
foreach line data [print line]
Cheers,
Allen K
[6/10] from: john:thousand-hills at: 3-Sep-2001 6:38
Ah, this one looks like Rebol... Easy..
Thanks..
John
At 12:44 PM 9/3/2001 +0200, you wrote:
[7/10] from: arolls::bigpond::net::au at: 3-Sep-2001 23:45
What does makerow do?
I am not really sure what you want to do.
Your first description was a bit vague to me.
I suggest
print makerow data/:n
in place of the probe below.
(Once again, probe is very useful, and similar to print).
[8/10] from: john:thousand-hills at: 3-Sep-2001 9:24
Anton..
Sorry for the confusing code, lets forget the makerow, let us ask -where
would I place a command to print the line?
Simply print the line -starting at line 7, until the file ends.
John
At 11:45 PM 9/3/2001 +1000, you wrote:
[9/10] from: arolls:bigpond:au at: 4-Sep-2001 1:47
Unless by "print" you mean something other than
the usual "send text to console window", then...
You really should read your mail more carefully. :)
Review my previous email below.
Just to explain a bit more:
data/:n references the nth item in the data series.
The colon : before n means "get the value of n"
The slash denotes a path. When an integer is supplied
it means to pick the item at the index of that integer.
[10/10] from: john:thousand-hills at: 3-Sep-2001 15:05
Anton:
Thanks. After reading more carefully (thanks for the advice) ;?)
The code worked like this:
data: read/lines %ROUTE.txt
data: skip data 6
foreach line data [print makerow line]
and since the first line was previously declared, like this..
data: skip data 6
foreach line data [print makerow line]
Makerow: is a script that places data in a row with formatting and HTML
code as needed.
Thanks //john
At 01:47 AM 9/4/2001 +1000, you wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted