Give this a try...I'm having a hard time connecting at the moment, so I'm unable to test it.
Code:
 on *:TEXT:@find*:#test:{
  var %i = 1, %found
  while $read(test.txt,w,$+(*,$2,*),%i) {
    var %i = $readn
    .notice $nick $read(test.txt,%i)
    inc %found
    if %found = 5 {
      var %i = $lines(test.txt)
    }
    inc %i
  }
  if !%found {
    .notice $nick Sorry no matches found
  }
}