Hi, I want to make a script that checks if any of the words of an incoming textline is in any of the lines of a textfile. I've been looking for the correct way of using $read for this but couldn't find it yet. Can anyone help please?

For example the script should find a match if the textline is

"this is a random sentence"

and the textfile contains:

word
word
word
word
word
random
word
word

Edit: for now I fixed it with a while loop that checks it for every word of the sentence, but I'd like to know if there's a better way to do it.

var %z = 1
while ($ [ $+ [ %z ] ] != $null) {
if ($read(textfile.txt,tnw,$ [ $+ [ %z ] ]) != $null) {
msg $chan test
}
inc %z
}

Last edited by FRAG_B; 05/04/15 12:25 AM.