reading large text file
reading large text file
- Subject: reading large text file
- From: email@hidden
- Date: Mon, 20 Aug 2001 12:41:18 EDT
I'm very rusty at using files in my scripts and I'm hoping someone can help.
I've been trying to figure this out for three days now and I'm getting
nowhere!
I have a text file with over 16,000 lines in it. The format for each line is
(### denotes a number):
### ### ### string
(i.e. "255 42 48 PANTONE 185 CVC")
What I need to do is search for the line that contains the string ("PANTONE
185 CVC") and extract the three numbers into variables. My problem is mostly
that the only way I can seem to do this is to read the whole file into a
variable and then search the variable. This creates memory issues and I don't
want to have to set the applet to 20 Mb RAM just for this, plus it takes too
long when the search string is at the beginning.
How can I read just one line of the file at a time into a variable and then
search for the string, stopping if I get a match and extracting the numbers
on that line? If anyone has a better method for dealing with this, that would
be appreciated too.
Thanks in advance.
Ken Fleisher
email@hidden