Code:
on 1:text:!search *:#mychannel:{
  var %rn = 1
  while ($read(database.txt,w,$2, %rn)) {
    msg $chan $v1
    var %rn = $readn + 1
  }
  msg $chan Finished database search.
}


Doesn't give you the number of results though.