Code:
findtxt {
  %i = 1
  filter -fk quotes.txt findtxt2 $+(*,$1-,*) [color:green] this find all rows including $1- word to findtxt2 ffunction [/color] 
  unset %i
}

findtxt2 { [color:green] and this function msg first three finded quotas to chan and then stops [/color]
  if ( %i > 3 ) { halt }
  msg $chan $1-
  inc %i 
}    


and i want to get this working on some trigger command. example: someone write !quotes xmas and this script will msg to chan first three lines from quotes.txt that includes word "xmas"

hope this is more easier to understand