Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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: ./program.pl 10.10.10.77 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/; }

In reply to Re^3: Problem with telnet and paging by tbone654
in thread Problem with telnet and paging by anton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (5)
    As of 2014-04-19 08:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (478 votes), past polls