[rancid] sorting output from custom commands...

john heasley heas at shrubbery.net
Wed Sep 29 15:49:28 UTC 2010


Wed, Sep 29, 2010 at 01:45:45AM +0100, Jon Peatfield:
>  CDP neighbors information
>
>   Port : 1
>   Device ID : SEP001FCA369E19
>   Address Type : IP
>   Address      : 172.18.18.179
>   Platform     : SIP11.8-5-3SCisco IP Phone 7911
>   Capability   :
>   Device Port  : Port 1
>   Version      : SIP11.8-5-3SCisco IP Phone 7911
>
> ------------------------------------------------------------------------------
>
>   Port : 1
>   Device ID : 01 ac 12 12 b3
>   Address Type : IP
>   Address      : 172.18.18.179
>   Platform     : Cisco IP Phone 7911G,V5, SIP11.8-5-3S
>   Capability   : Switch
>   Device Port  : 001FCA369E19:P1
>   Version      : Cisco IP Phone 7911G,V5, SIP11.8-5-3S

though this looks legitimate; some of the phones have two device.  i'd
keep track of the port's seen (or just last port) and skip duplicates.

> 	if (/^\s*Port\s*:\s*(.*)/) {
> 	    my $newport=$1;
if port == lastport
 read until ^$
else
 read, processhistory, until ^$


More information about the Rancid-discuss mailing list