Now I got only that line written (rough, but worked for me). Still using a tempfile, but it's smaller now at least

on *:SOCKREAD:YOURSOCKNAME: {
; - your error handling etc here -
:read
sockread -fn &YOURBINVAR
if ($sockbr) {
; start writing at [linestart][space]<p><b> (skip ~5k-15k+ bytes at the start)
if ($bvar(&YOURBINVAR,1,7).text == $chr(32) $+ <p><b>) { set -e %imdb.line $true }
; close socket at [linestart]<b>Suggestions For Improving Your Results</b> (skip ~7k bytes at the end)
elseif ($bvar(&YOURBINVAR,1,45).text == <b>Suggestions For Improving Your Results</b>) {
imdb.sockclose $sockname
sockclose $sockname
return
}
; write read to tempfile
if (%imdb.line == $true) { bwrite YOURTEMPFILE -1 -1 &YOURBINVAR }
goto read
}
}
On sockclose triggers for a remote sockclose. As the socked now isn't (always) closed remotely: move the "on sockclose" code to a custom alias. I kept the sockclose event only to play safe a bit.
on *:SOCKCLOSE:YOURSOCKNAME:{ imdb.sockclose $sockname }
alias -l imdb.sockclose {
unset %imdb.line
- the code you had in the sockclose event here. -
- $sockname is now $1; you could pass sockmarks as well -
}
EDIT: the (%pos < %end) comparison in the bfind loop is obsolete now. Just set %pos to 1.