Digital Mages

Digital Mages - ipconsolidate(1)

IPCONSOLIDATE

Section: User Contributed Perl Documentation (1)
Updated: 2019-04-21
Index  

NAME

ip-consolidate - Consolidates a list of IPs to non-redundant items  

VERSION

$Id: bin/ipconsolidate, 0.2 2019/04/21 20:47:51 acorliss Exp $  

USAGE

    cat network-list | ip-consolidate > new-list

 

DESCRIPTION

This is an extremely simple script that reads in any kind of arbitrary input, extracts all IPv4 or IPv6 addresses, removes any redundant entries, then prints out a sorted list of the remaining addresses.

The real value of this script lies in not just removing redundant entries, but also network intersections. For instance, if you had:

    192.168.1.119, 192.168.0.54, 192.168.0.0/24

the script would output:

    192.168.0.0/24
    192.168.1.119

NOTE: Any intersections found are printed on STDERR so you can see what it found and what it kept. For example:

    found intersection:  -1: 162.144.45.0/24  162.144.0.0/16
    found intersection:  1: 74.63.192.0/18  74.63.215.128/25
    found intersection:  1: 2001:470:b:81d::/64  2001:470:b:81d::d8

The first value tells you what the comparison value of the intersection was. If it is 1 then it kept the first address. A value of -1 means that it kept the second address, instead.  

REQUIRED ARGUMENTS

None.  

OPTIONS

None.  

DIAGNOSTICS

None.  

EXIT STATUS

Always 0  

CONFIGURATION

None.  

BUGS AND LIMITATIONS

Regardless of the format of the list fed to this script, it will always return the consolidated list in the same format: one IP/network per line.  

AUTHOR

Arthur Corliss (corliss@digitalmages.com)  

LICENSE AND COPYRIGHT

This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information.

(c) 2019, Arthur Corliss (corliss@digitalmages.com)


 

Index

NAME
VERSION
USAGE
DESCRIPTION
REQUIRED ARGUMENTS
OPTIONS
DIAGNOSTICS
EXIT STATUS
CONFIGURATION
BUGS AND LIMITATIONS
AUTHOR
LICENSE AND COPYRIGHT