Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: Problem with telnet and paging

by tbone654 (Beadle)
on Dec 24, 2012 at 21:06 UTC ( #1010232=note: print w/replies, xml ) Need Help??

in reply to Re^2: Problem with telnet and paging
in thread Problem with telnet and paging

this works for me on my CISCO's... may be it's the lines...

$telnet->prompt('/\w+# $/'); $telnet->waitfor($telnet->prompt);
that make it work... Don't know, just figuring this out myself...
usage: ./ z.out

#!/usr/bin/perl use strict; use warnings; use Net::Telnet; my $uri = shift @ARGV or die "IP address needed \n Usage: ./runssh 10. +10.10.77 outputfile"; my $a = shift @ARGV or die "output file needed \n usage: ./runssh 10.1 +0.10.77 outputfile"; my $telnet = new Net::Telnet (Timeout=>15 #,Input_log => "received_data.txt" ,Input_log => $a ); $telnet->open($uri); $telnet->waitfor('/login: /i'); $telnet->print('Place_the_login_here'); $telnet->waitfor('/Password: /i'); $telnet->print('Place_the password_here'); print "Login is successful \n"; $telnet->prompt('/\w+# $/'); $telnet->waitfor($telnet->prompt); $telnet->cmd("terminal length 0"); $telnet->cmd("show interface brief"); $telnet->cmd("sh int desc"); $telnet->cmd("sh flogi data"); $telnet->cmd("sh zone act"); $telnet->waitfor($telnet->prompt); my $out = $telnet->print('exit'); print $out; $telnet->close(); my $fname = "received_data.txt"; open (my $fh, "<", $fname) or die "Can't open"; while (<$fh>) { print if /ip prefix-list/; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010232]
[MidLifeXis]: Weird - my team is receiving a request for information barely related to a project we are on, asking for information already available to the user from a corporate data source, which happens to be the same source we would use.
[MidLifeXis]: It seems like the requester believes that we have some magic 8 ball source of info that he doesn't have access to.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-01-20 18:53 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (176 votes). Check out past polls.