#!/usr/bin/perl #============================================================================= # # Simple script to search through IOS configuration files for # interface configurations # # Copyright 2006 The University of Wisconsin Board of Regents # Licensed and distributed under the terms of the Perl Artistic # License, see http://net.doit.wisc.edu/~dwcarder/scripts/ for # details. # # Written by: E. Janet Plato # Network Services Group # Division of Information Technology # University of Wisconsin at Madison # # For more about this and other tools, see # http://net.doit.wisc.edu/~dwcarder/scripts/ # #============================================================================= if ($#ARGV < 1) { print "Usage: $0 ifname [file list]\n"; } $if = shift @ARGV; while (<>) { if ($_ =~ /^!/) { undef $inblock; } elsif ($_ =~ /^interface.*$if\r/) { print "Found stanza in $ARGV\n"; print $_; $inblock = 1; } else { if ($inblock) { print $_; } } }