How are the join messages stored in the file ? What is the name of the file ?
Tell us more please.
For instance, if the messages are stored as this:
nick01 join message
nick02 join message
which are, I think, two possible ways of storing 'indexed' information, then the search through the file is relatively simple to the knowledge of the w or the r option of the $read identifier. The w option makes a wildmatch on all lines of a file until it finds a match, the r option uses regular expressions to do the same.
Have a look at:
It may help