Thread Tabelle Teilen (22 answers)
Opened by nour at 2007-02-06 11:59

renee
 2007-02-06 14:28
#74068 #74068
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
In dem Code, den Du oben gepostet hast, war noch nicht mein Lösungsvorschlag eingebaut...


Aber probier mal das hier:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl -w
#DatenbankAbfragen

use strict;
use warnings;
use DBI;
use Net::Telnet::Cisco;

my $session = Net::Telnet::Cisco-> new (Host => '10.100.20.100);
$session->login('admin', 'name);

# Execute a command
my @output = $session->cmd('show run');
my $string = join '',@output;

my @infos = split /interface ATM/,$string;
#shift @infos;

my %hash;
for my $interface(@infos){
my ($bez) = $interface =~ /^([^\n]+)/;
my @data = $interface =~ /(pvc.*?cbr 128)/sg;
for my $daten(@data){
my ($id,$ip) = $pvc =~ /(\s*[\d\/]+).*?protocol ip ((?:\d{1,3}\.){3}\d{1,3})/s;
push @{$hash{'ATM'.$bez}}, [split(/\//,$id),$ip];
}
}

for my $atm(keys %hash){
print sprintf("%10s | %10s | %10s | %15s\n",$atm,'Daten1','Daten2','IP');
print sprintf("%10s | %10s | %10s | %15s\n",' ',@$_) for @{$hash{$atm}};
}
\n\n

<!--EDIT|renee|1170764934-->
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Tabelle Teilen