Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I capture data from incoming stream w/ scrollback on ?

Status
Not open for further replies.

Dpott

Technical User
Sep 12, 2003
4
0
0
US
Thanks to Knob for you answer to my last post. That ITOA command really helped !

I am attempting to capture data from an incoming data stream, but need to use scrollback. Everything I have read says that you must have scrollback turned off !

I am receiving streams of data which are much longer than one screen (hence scrollback is needed). I need to capture an integer when a certain phrase appeared in the incoming stream.

For example, when an "xxxx : 1,000" was transmitted, I need to capture the number to the right of xxxx and then convert to an integer for use in my script.
 
Are you trying to capture the entire stream of data, or just the integer you are looking for? I would think the information you are looking for would not be more than a screen's worth, although the entire stream may be. How are you capturing the data currently?


aspect@aspectscripting.com
 
I just need to capture certain integers when they appear in the stream of data. This is during an open telnet session where the data is sent when I press certain keys. The TERMGETS command seems to be exactly what I need, but it will not work with scrollback on. For example, when I press the "T" key, I receive the data :

xxxx : 1,203 xxx1 : 100,208 xxx2 : 100,777
xxx3 : 100,073 xxx4 : 1,202
xxx5 : 1,277
xxx6 : 108,327

I am trying to automate a process when my script will transmit "t" then grab certain values. Let's say I need to grab the values xxxx and xxx4 and covert to an integer for my script. The values I need will be on random rows and columns of the terminal window when the keys are transmitted. The telnet session I am connecting to does not display the data properly unless scrollback is used.

I am not capturing any data right now, I do not know how to do it ! (beginner)



 
I guess the first question I have is about having to use the scrollback buffer to get the data to appear correctly. It does not appear correctly when initially displayed, but looks OK in the scrollback buffer? Or does so much data appear that what you are looking for moves into the scrollback buffer?


aspect@aspectscripting.com
 
Yes to your second question...
The program does not issue a clear command after the data is sent. Unless I have to scrollback on, the data overwrites itself making it diffuicult to read correctly.
I can go back maunally with the scrollback and retrieve the data which I need, but I would like to set up a process where it will capture it as it goes by and store it in variables.
 
Probably the easiest way to do this then is to issue the clear command before you send the command that sends the data. Then open a capture file (capture on, may also need to use some of the set capture commands to make everything "right"), issue the command that sends the data, then use capture off to close the capture file. You can then use fopen/fgets/fclose to open the capture file from disk, go through it line by line, and get the variables you need.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top