A much simpler and much much more efficient way to do this is:
filter -ffx [color:blue]filename.txt filename.txt[/color] [color:green]searchtext[/color] *
(Yes, the filename should be written twice).
This way the file is only opened and edited once, whereas using the other ways you've been shown here mIRC is effectively opening the file, looking at it, and closing it, twice per matching line using the $read() searching method, or in for the line-looping method it's actually opening the file, looking at it, and closing it twice per line
- that's potentially hundreds of times for a relatively small file!