Ok, my last piece of code should be ignored as it was doing weird stuff.
This is my new and probably ultimate solution for handling big text files in mirc when the objective is to search for a keyword and get the next 2 lines.

Code:
/test7 {
  echo 6 -sn Begin test7 at $asctime(HH:nn:ss)
  var %nbr.line 1
  ;first word to search for
  set %word.to.search * $+ $read(%loc $+ wordlist.txt,%nbr.line) $+ *
  while (%nbr.line <= $lines(%loc $+ wordlist.txt)) {
    .fopen filestream D:\mIRC_email\kopie.txt
    .fseek -w filestream %word.to.search
    while (!$ferr && !$feof) {
      set %LinkInEmailBegin $wildtok($fread(filestream),%word.to.search,1,62)
      set %LinkInEmailMiddle $fread(filestream),$chr(39),$chr(34)
      set %LinkInEmailEnd $fread(filestream),$chr(39),$chr(34)
      set %LinkInEmail %LinkInEmailBegin $+ %LinkInEmailMiddle $+ %LinkInEmailEnd
      ;here I doing some modifying on the long link before writing it to a file
      .fseek -w filestream %word.to.search
    }
    .fclose filestream
    inc %nbr.line
    ;next word to search for
    set %word.to.search * $+ $read(%loc $+ wordlist.txt,%nbr.line) $+ *
  }
  echo 6 -sn End test7 at $asctime(HH:nn:ss)
}


The file D:\mIRC_email\kopie.txt was 10Mb and the result was:

Begin test7 at 18:44:55
End test7 at 18:46:12

So 1 minute and 17 seconds! and it created 2161 links.

Now I'm a happy puppy smile

Last edited by macrobody; 02/05/12 12:28 PM.