Digital Mages - ipconsolidate(1)
Section: User Contributed Perl Documentation (1)
ip-consolidate - Consolidates a list of IPs to non-redundant items
bin/ipconsolidate, 0.2 2019/04/21 20:47:51 acorliss Exp $
cat network-list | ip-consolidate > new-list
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:
NOTE: Any intersections found are printed on STDERR so you can see what
it found and what it kept. For example:
found intersection: -1: 22.214.171.124/24 126.96.36.199/16
found intersection: 1: 188.8.131.52/18 184.108.40.206/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.
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.
Arthur Corliss (firstname.lastname@example.org
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 (email@example.com)
- REQUIRED ARGUMENTS
- EXIT STATUS
- BUGS AND LIMITATIONS
- LICENSE AND COPYRIGHT
Copyright © 1997 - 2016,
Arthur Corliss, all rights reserved.