Richard MacLemale wrote:
>
> MetaGurus,
> I want to read a certain specified range of line numbers from a huge text
> file. What's the best way to do this? What I'd like is something like:
>
> open file thisFile
> read from file thisFile from line 189 to line 300
> put it into myVar
> close file thisFile
>
> ...except that this obviously won't work. You can't specify a beginning
> line and an ending line to read from a file, can you?
>
> Normally you'd think to just load the whole file into a variable and then
> work with it, but this file is huge and needs to be accessed numerous times,
> and different lines will be read each time. I know I can use character
> numbers but would prefer not to. Can anyone help?
>
> Richard MacLemale
> www.coolclassroom.com
Hi Richard,
The script below is fine running in my own apps :
open file thefile for read
read from file thefile until eof
put line 189 to 300 of it into b
close file line 1 of the openFiles
If your platform is unix and this script don't run on it, just set the
read permissions of the file to "yes" and it will run again...
Have fun and a big and good new millenium...
Pierre
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pierre Sahores CRDP de l'academie de Creteil
Tel.: +33 143247509 20, rue Daniele-Casanova
Fax.: +33 148726072 94170 Le Perreux - France
[EMAIL PROTECTED] http://www.ac-creteil.fr/crdp/
Web applications servers design, XTalk's, MacOS, Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm