Home > Archive > PERL Miscellaneous > July 2005 > DMS Nortel switch - getting all data
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
DMS Nortel switch - getting all data
|
|
|
|
Hi All,
I'm having trouble finding the end of a file. I'm working with a
Nortel DMS switch. Once I've logged in I have to wait to retrieve the
contents of the buffer. Ever 5 minutes the switch kicks the data out.
I'm using the following command to store the buffer contents into a
variable but it only graps the first few lines of the buffer.
my @datastream = $telnet->waitfor('/\>$/i');
@bufferdata = "@bufferdata @datastream";
On the switch the last character is a ">" and that character only shows
up at the end of the buffer data. The problem is when perl retrieves
the contents of the buffer, every line contains a ">". Is there not
some way to otherwise determine when all the data has been retrieved?
I tried "sleep 10" but that doesn't work either.
Any help would be appreicated.
Chris
| |
| John W. Krahn 2005-07-29, 5:04 pm |
| Nex_s wrote:
>
> I'm having trouble finding the end of a file. I'm working with a
> Nortel DMS switch. Once I've logged in I have to wait to retrieve the
> contents of the buffer. Ever 5 minutes the switch kicks the data out.
> I'm using the following command to store the buffer contents into a
> variable but it only graps the first few lines of the buffer.
>
> my @datastream = $telnet->waitfor('/\>$/i');
The '>' character is not special in a regular expression so there is no
need to backslash it and there are no alphabetic characters in the
pattern so there is nothing for the /i option to affect.
> @bufferdata = "@bufferdata @datastream";
Why are you using an array to store scalar data, why not just use a scalar?
$bufferdata .= " @datastream";
> On the switch the last character is a ">" and that character only shows
> up at the end of the buffer data. The problem is when perl retrieves
> the contents of the buffer, every line contains a ">". Is there not
> some way to otherwise determine when all the data has been retrieved?
> I tried "sleep 10" but that doesn't work either.
>
> Any help would be appreicated.
Perhaps there is whitespace after the '>' prompt? Maybe something like
this will work:
my @datastream = $telnet->waitfor( '/>\s*$/' );
John
--
use Perl;
program
fulfillment
|
|
|
|
|