[TF] Grabbing a chunk of text delimited by prompts
Brought to you by:
kenkeys
|
From: fbneal at mac.c. (B. Neal) - 2003-03-11 20:42:30
|
I'm beginning to tackle a problem and I was wondering if anyone here as seen it/done it before. What I want to do is take the output of a command, such as an inventory list, and pipe it to an external Perl script for processing. If necessary, I can get that processed info back using /quote. The real issue I'm having trouble finding a solution for is determining when to stop grabbing the output. The way I'm approaching it is to write the lines of interest out to a temp file using tfwrite(). The lines can be matched easily with a regexp (or even a glob) , and I know that I will receive them after entering a specific command. What is not clear is how to tell my writer to stop. The only delimiter I have is that I receive a new prompt. I could put something in the prompt hook that disables the writer, but I already have a -huge- amount of processing that goes on there, and this will be a very infrequently invoked macro. Also, that splits the functionality of this macro up over two files (my prompt.tf and the file containing the scripts for displaying my inventory in various different ways). Does anyone see a better, simpler way to do this, or has anyone done something like this before? Thanks, Brent As an aside: It'd be tres cool if someone hacked in PCRE support for matching. I do a lot of Perl hacking, and having to 'switch gears' to write regexps for TF is always mind warping. -- Brent Neal Geek of all Trades "Specialization is for insects" -- Robert A. Heinlein |