#!/usr/bin/perl -w use Switch; my $num_Args=$#ARGV +1; if ($num_Args !=2) { print "\nUsage: Argument 1 is the filename to parse, Argument 2 is the Management Ip address\n"; exit; } my $filename = $ARGV[0]; my $ipaddr= $ARGV[1]; open (my $fh, $filename) or die "Could not open file '$filename' $!\n"; while (my $row = <$fh>) { chomp $row; switch ($row){ #print $row; case /config system interface/ { <>; if (/edit \"internal1\"/) { print "Number was 1\n"; $grabbing=1; } elsif ( /^$/ ) { $grabbing = 0; } if ($grabbing ) { push @grabbed, @_; } } } print @grabbed; }