<HTML><FONT FACE=arial,helvetica><FONT SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">I'm pretty sure the problem with speed here is from reading in the entire file.<BR>
Unless of course you have enough free RAM- but that's hard to imagine when the files are 300MB+.<BR>
<BR>
How about this, which you can adjust to read any given number of lines at a time.<BR>
Try it with 10, 1000, 10000, etc and see what gives you the best performance!<BR>
Hasn't been tested but hopefully it'll run with a tweak or less.<BR>
<BR>
#!/usr/local/bin/mc<BR>
on startup<BR>
## initialize variables: try adjusting numLines<BR>
put "/gig/tmp/log/xaa" into the_file<BR>
put 1000 into numLines<BR>
put 0 into counter<BR>
<BR>
open file the_file<BR>
<BR>
repeat until (isEOF = TRUE)<BR>
## read the specified number of lines, check if we are at the end of the file<BR>
read from file the_file for numLines lines<BR>
put it into thisChunk<BR>
put (the result = "eof") into isEOF<BR>
<BR>
## count the number of matches in this chunk<BR>
put offset("mystic_mouse", thisChunk) into theOffset<BR>
repeat until (theOffset = 0)<BR>
add 1 to counter<BR>
put offset("mystic_mouse", thisChunk, theOffset) into tempOffset<BR>
if (tempOffset > 0) then add tempOffset to theOffset<BR>
else put 0 into theOffset<BR>
end repeat<BR>
<BR>
end repeat<BR>
<BR>
close file the_file<BR>
<BR>
put counter<BR>
end startup<BR>
<BR>
<BR>
HTH,<BR>
Brian</FONT></HTML>