print "Device list containte in the device.list file will be a CSV file\n\n"; print "The device.list file will consist of only the device OS and category \n"; print "This script works on CISCO routers.\n\n"; print "Enter username:\n"; $username = ; chomp $username; print "Enter password:\n"; $password = ; chomp $password; print "Enter the command you want issued:\n"; $cmd = ; chomp $cmd; print "Enter the string you want to search for:\n"; $string = ; chomp $string; print "\n\n\n"; #print "password is -$password-\n"; #print "username is -$username-\n"; #print "command is -$cmd-\n"; #print "search string is: -$string-\n"; use Net::Telnet::Cisco; open (DEVICE, 'device.list'); while () { chomp; $routerIP = $_; print "Router IP is $routerIP,"; my $session = Net::Telnet::Cisco->new(Host => "$routerIP", Input_log=>"input.log", ); $session->login("$username", "$password"); my @output = $session->cmd("$cmd"); for $_ (@output) { #BRACKET A my $statline = $_; chomp $statline; if ($statline =~ /($string)/) { #Bracket B print "$statline"; } # end Bracket B } print "\n"; } exit;