Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!c:/perl/bin/perl.exe
- my @interface=();
- my $isInterface=0;
- my $currentInterface="";
- my $currentType="";
- my $currentSlot="";
- my $currentPort="";
- my @Config=();
- open (FILE, "hub1.conf");
- while (<FILE>)
- {
- chomp;
- if ($isInterface==1)
- {
- if (/!/)
- {
- $interface[$currentSlot][$currentPort]=\@$currentInterface;
- # $isInterface = 0;
- # $currentInterface="";
- # $currentType="";
- # $currentSlot="";
- # $currentPort="";
- next;
- }
- else
- {
- #print "$currentInterface\n";
- push @$currentInterface, $_;
- next;
- }
- }
- if (/interface (.*)(\d+)\/(\d+)/)
- {
- $currentType = $1;
- $currentSlot = $2;
- $currentPort = $3;
- $currentInterface = "$1$2/$3";
- $isInterface = 1;
- push @$currentInterface, "interface $currentInterface";
- }
- }
- print "Interface is $currentInterface\n";
- for $i ( 0 .. $#interface ) {
- for $j (0 .. $#{$interface[$i]}) {
- foreach $port ($interface[$i][$j])
- {
- foreach $line (@$port)
- {
- if ($line=~/Gigabit/)
- {
- print "$line\n";
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement