Here is the code I came up with:
Code:
on *:TEXT:.qammount*:#:{
  var %l = 1,%r = 0
  while ( $read([color:green]test.txt[/color],w,* $+ $2- $+ *,%l) != $null ) {
    var %l = $readn + 1
    inc %r
  }
  msg # " $+ $2 $+ " found in %r $+ / $+ $read([color:green]test.txt[/color],0) quotes.
}


P.S. You could use $lines(test.txt) rather than $read(test.txt,0), it would save you having to fiddle around with the first number of the file everytime you added/removed a quote (if that's what you're doing, that is).