Code:
alias tfi {
  if !$read($1,nw,*?= $+ $2) { return }
  if $read($1,nw,[*?],$readn) { return $ini($1,$calc($ini($1,$mid($ifmatch,2,-1)) - 1)) }
  return $ini($1,$ini($1,0))
}


Usage: $tfi(<filename>,<search string>)
returns the section name, fex, in the example ini in my previous post, $tfi(filename.ini,bar) returns "blah"

Look up both $ini() and $read() in the help file and read carefully. What I'm doing here is use $read() to find the line number that contains the matching item. Then I use $read() again to search for the 1st section right after the line of matching item. If it's found, I use $ini() to get the previous section, which is the one that the matching item belongs to. If it's not found, it means that the matching item belonged to the last section of the file, so I use $ini($1,$ini($1,0)) to get that.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com