<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Trying to capture ‘show interface status’ output from Cisco IOS switches, but ignore the output for diff purposes. Is that possible? I guess it would have to be part of the mailer function to not send output for certain lines.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I copied the ShowVLAN sub-routine because it already appends ! in front of the lines, so they are not considered config lines. But right now I can’t even get the output captured.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is the new sub I am using:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"># This routine parses "show interface status"<o:p></o:p></p>
<p class="MsoNormal">sub ShowIntStat {<o:p></o:p></p>
<p class="MsoNormal">    print STDERR "    In ShowIntStat: $_" if ($debug);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    #($_ = <INPUT>, return(1)) if (!$DO_SHOW_INT_STAT);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    while (<INPUT>) {<o:p></o:p></p>
<p class="MsoNormal">        tr/\015//d;<o:p></o:p></p>
<p class="MsoNormal">        last if (/^$prompt/);<o:p></o:p></p>
<p class="MsoNormal">        next if (/^(\s*|\s*$cmd\s*)$/);<o:p></o:p></p>
<p class="MsoNormal">        return(1) if /^\s*\^\s*$/;<o:p></o:p></p>
<p class="MsoNormal">        return(1) if /Line has invalid autocommand /;<o:p></o:p></p>
<p class="MsoNormal">        return(1) if /(Invalid input detected|Type help or )/;<o:p></o:p></p>
<p class="MsoNormal">        return(1) if /Ambiguous command/i;<o:p></o:p></p>
<p class="MsoNormal">        # newer releases (~12.1(9)) place the vlan config in the normal<o:p></o:p></p>
<p class="MsoNormal">        # configuration (write term).<o:p></o:p></p>
<p class="MsoNormal">        #return(1) if ($type =~ /^(3550|4500)$/);<o:p></o:p></p>
<p class="MsoNormal">        #return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);<o:p></o:p></p>
<p class="MsoNormal">        return(-1) if (/command authorization failed/i);<o:p></o:p></p>
<p class="MsoNormal">        # the pager can not be disabled per-session on the PIX<o:p></o:p></p>
<p class="MsoNormal">        if (/^(<-+ More -+>)/) {<o:p></o:p></p>
<p class="MsoNormal">            my($len) = length($1);<o:p></o:p></p>
<p class="MsoNormal">            s/^$1\s{$len}//;<o:p></o:p></p>
<p class="MsoNormal">        }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">        ProcessHistory("COMMENTS","keysort","IO","!INT: $_");<o:p></o:p></p>
<p class="MsoNormal">    }<o:p></o:p></p>
<p class="MsoNormal">    ProcessHistory("COMMENTS","keysort","IO","!\n");<o:p></o:p></p>
<p class="MsoNormal">    return(0);<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
</div>
</body>
</html>