mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I don't like how my college class search is set up so I'm parsing through to see which classes fill two or more gen ed requirements. It works. But mIRC seems to crash around line 800. Once I saw it get to around line 2,000. There are about 30,000 lines.

Code:
alias doit {
  var %file = stupid.txt
  var %i = 1
  var %lines = $lines(%file)
  while (%i <= %lines) {
    var %read =  $read(%file,%i)
    if (General Education Course:*:* iswm %read) {
      echo -s Line: $readn $+ : %read
    }
    inc %i
  }
}

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm not sure why this is happening, and I don't see anything wrong with your code. Here, however, is an alternative code that I think should work (I don't have a file that size to test it)
Code:
alias doit {
  if !$hget(classes) { .hmake classes 5000 }
  if $exists(stupid.txt) { .hload -n classes stupid.txt }
  var %i = 1, %lines = $hfind(classes,General Education Course:*:*,0,w)
  while %i <= %lines {
    var %line = $hfind(classes,General Education Course:*:*,%i,w)
    echo -s Line: %line $+ : $hget(classes,%line)
    inc %i
  }
}


Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Or you could use /filter.
Code:
alias doit {
  filter -fkn stupid.txt _stupid General Education Course:*:*
}
alias -l _stupid {
  tokenize 32 $1
  echo -s Line: $1: $2-
}


Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Nicely done deegee. I looked at /filter but haven't used it enough to realize how effective it would actually be for this.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Thank you deegee, that worked perfectly.


Link Copied to Clipboard