Thread Tabelle Im PErl (7 answers)
Opened by nour at 2006-11-15 12:08

nour
 2006-11-15 12:08
#71745 #71745
User since
2006-11-15
108 Artikel
BenutzerIn
[default_avatar]
Hallo.
ich arbeite an eine cisco Router , der Ergebniss der mein Script liefert kommt danach in eine Datenbank!

Nun Hier ist mein Script:

__________________________________________
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/perl -w


use Net::Telnet::Cisco;

use strict;

my $linec;
my $line;
my $interface;
my $pvc;
my $array;
my $ip;
my $cbr;
my $session = Net::Telnet::Cisco-> new (Host => '10.200.2.100');
$session->login('admin', 'cisco');

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

#print @output;
foreach(@output)
{
if ( $_ =~ "interface ATM" ) {
$interface=$_;
chomp($interface);
#print "$_\t";
print" Int:\n $interface \n\n";
}

if ( $_ =~ "pvc"){

$pvc=$_;
chomp($pvc);
#print "$_\t";
print" PVC\t :$_\t\t ";

}
if ( $_ =~ "protocol ip " ){

$ip=$_;
chomp($ip);
#print "$_\t";
print" IP\t :$ip\n";
}



if ( $_ =~ "cbr" ){

$cbr=$_;
chomp($cbr);
#print "$_\t";
#print" CBR|$cbr";
}

#print "Int:$interface | PVC:$pvc | IP:$ip |Cbr:$cbr \n";
# print " Int|PVC |IP|Cbr \n";
#print" $interface |$pvc|$ip|$cbr \t";
}

____________________________________________mein Ergebniss auf die Console ist wie Folgendes:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
interface ATM1/0

PVC :
pvc 22/180 IP :
protocol ip 10.200.50.81
PVC :
pvc 22/190 IP :
protocol ip 10.200.50.83
PVC :
pvc 22/202 IP : protocol ip 10.200.50.82
PVC :
pvc 122/202 IP :
protocol ip 10.200.51.82

___________________________________________________
Nun ich will ein Folgende Ergebnis Haben :
Code: (dl )
1
2
3
4
5
6
 ATM1/0 |PVC                 | IP 
pvc 22/180 10.200.50.81
pvc 22/190 10.200.50.83
pvc 22/202 10.200.50.82

pvc 122/202 10.200.51.82

in art eine Tabelle

wie kann ich MEin Problem Lösen.

Danke im Voraus.\n\n

<!--EDIT|renee|1163586042-->

View full thread Tabelle Im PErl