| korinthe 2007-02-21, 7:15 pm |
| First off, apologies if there is something like comp.lang.tcl.expect
out there. I couldn't find it.
I've written an expect script to process a text file that contains
captured output from an interactive session. (The idea is to reuse
code, when I get around to doing the same tasks in the future.) I've
run into a problem that is probably a result of using the capture file
rather than an interactive session with the server. Hoping someone has
a good idea about how to tackle this.
The capture file looks something like this:
> [command to server]
[output from command, header line followed by arbitrary number of
lines]
over and over. I have to capture info from each line of the response,
yet my expect script doesn't know how many lines there will be. I
can't go till EOF, because I still need to capture the info from the
header line of each response.
I think I need a kind of look-ahead expect() that doesn't actually eat
the lines, and that would tell me which of two possible patterns
matched *nearest* to the current position. Does something like this
exist?
Another option would be telling expect() to only try to match within a
certain number of chars. I know the max possible line length. But I
couldn't find evidence of this in the documentation.
Thanks for any ideas you can share.
|