I'm trying to write something that'll search the last 50 lines of a file, for a certain word, and if it finds it..echo's the last line out of those 50 that has that word in it.

Example..let's say hello.txt has 200 lines in it. I'm trying to get it to search lines 150-200 for the word "hello", and if it finds it, echo's it. So if it found a "hello" in line 170 and 190..it would only echo line 190.

any ideas?

Edited:

This..
msg # $iif($read(hello.txt, w, *hello*, $calc($lines(hello.txt) - 1)),$read(hello.txt, n, $readn))
..keeps giving me Insufficient Parameters. It works just fine if i put it at -10 or -9, but nothing below that. Is it because the last 8 lines of the hello.txt begin with (1)hello or (2)hello..etc?

Edited:

N/m, know why it's not working. Anyone got another idea that'd work?