The following is supposed to delete the third token in a line if that token matches some criteria. As it is now, it doesn't or it randomly deletes correct lines. How come?

Code:
on *:TEXT:!del*:%m.channel:{ 
  set %m.quitter3 $nick
  set -u30 %m.diderase. [ $+ [ %m.quitter3 ] ] 0
  set -u30 %m.loopedDe1 [ $+ [ %m.quitter3 ] ] 1

w hile (%m.loopedDe1 [ $+ [ %m.quitter3 ] ] <= $lines(%m.filepath)) {

set %m.trash3 $read(%m.filepath,%m.loopedDe1 [ $+ [ %m.quitter3 ] ])

if ($gettok(%m.trash3,3,32) == %m.quitter3) { 
echo -s 4 %m.quitter3 found on line: %m.loopedDe1 [ $+ [ %m.quitter3 ] ] 

[color:red] 
write -dl $+ %m.loopedDel [ $+ [ %m.quitter3 ] ] %m.filepath
[/color] 

notice %m.quitter3 Erased from list > $read(%m.filepath,%m.loopedDe1 [ $+ [ %m.quitter3 ] ])

set %m.diderase. [ $+ [ %m.quitter3 ] ] 1
echo -s erased %m.quitter3 on request.
    }

inc %m.loopedDe1 [ $+ [ %m.quitter3 ] ] 1

  }
  ; while ends

if (%m.diderase. [ $+ [ %m.quitter3 ] ] == 0) { notice %m.quitter3 Didn't find an entry to erase. }

}
  


Or...if the above is a mess: What's the best way to check every line in a file for a %variable and delete all lines containing that exact variable? (File won't be bigger than 100 lines).