>
> >
> >I would do it something like this:
> >
> >file: read/lines %test.txt ; read the file line by line
> > ; into a variable
> >z: length? file ; find out how many lines there are
> >x: 0 ; use this variable to track lines
> >loop z [ ; set up a line by line loop
> > x = x + 1 ; specify line number in sequence
> > print pick file x ; print the current line number
> > ]
> >
Of course, you'll want to eliminate as many variables as possible,
depending on your needs. For example:
;
; if you just need to process the lines
;
foreach line read/lines %test.txt [
print line
]
;
; if you need line numbers
;
lines: read/lines %test.txt
forall lines [
print [index? lines first lines]
]
and so on...
-jn-
- [REBOL] [REBOL] Update file as ... tjohnson
- [REBOL] [REBOL]Controlling secu... tjohnson
- [REBOL] [REBOL]Controlling secu... kracik
- [REBOL] [REBOL]Controlling secu... tim781
- [REBOL] [REBOL]Controlling secu... news . ted
- [REBOL] [REBOL]Controlling secu... tjohnson
- [REBOL] [REBOL]Controlling secu... joel . neely
- [REBOL] Re: Updating a file as a po... giesse
- [REBOL] [REBOL] Reading text a line at a time Re... ralph
- [REBOL] Reading text a line at a time Re:(2) tjohnson
- [REBOL] Re: Rebol Web Server joel . neely
- [REBOL] Re: Rebol Web Server giesse
- [REBOL] Rebol Web Server Re:(2) Petr . Krenzelok
- [REBOL] Rebol Web Server Re:(3) dado
- [REBOL] Rebol Web Server Re:(4) Petr . Krenzelok
- [REBOL] Rebol Web Server Re:(5) robert . muench
- [REBOL] Rebol Web Server Re:(6) joel . neely
- [REBOL] Rebol Web Server Re:(7) robert . muench
- [REBOL] Re: Rebol Web Server Re:(5) ejolson
- [REBOL] Rebol Web Server Re:(7) robert . muench
- [REBOL] Re: Rebol Web Server Re... ejolson
