Right now I've got a large list of IP addresses due to using /24 subnet breakdowns, however I want to reduce my subnets to the tightest possible subnet to accommodate IPs in the range. To this I need to know the difference between the minimum and maximum of the values within the /24 range. My data looks like the following:
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
And I'd like to know the following two columns:
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[TD]Difference in Sub between min and Max[/TD]
[TD]Min IP[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[/TR]
</tbody>[/TABLE]
With that I can easily calculate the best subnet to use
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[TD]Difference in Sub between min and Max[/TD]
[TD]Min IP[/TD]
[TD]Best Subnet[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[TD]/31[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[TD]/31[/TD]
[/TR]
</tbody>[/TABLE]
Any help will be appreciated!
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
And I'd like to know the following two columns:
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[TD]Difference in Sub between min and Max[/TD]
[TD]Min IP[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[/TR]
</tbody>[/TABLE]
With that I can easily calculate the best subnet to use
[TABLE="width: 500"]
<tbody>[TR]
[TD]IP SUBNET[/TD]
[TD]IP[/TD]
[TD]4th_Oct[/TD]
[TD]Difference in Sub between min and Max[/TD]
[TD]Min IP[/TD]
[TD]Best Subnet[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.1[/TD]
[TD]1[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.24[/TD]
[TD]24[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.1.0/24[/TD]
[TD]192.168.1.158[/TD]
[TD]158[/TD]
[TD]157[/TD]
[TD]192.168.1.1[/TD]
[TD]/24[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[TD]/31[/TD]
[/TR]
[TR]
[TD]192.168.2.0/24[/TD]
[TD]192.168.2.4[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]192.168.2.2[/TD]
[TD]/31[/TD]
[/TR]
</tbody>[/TABLE]
Any help will be appreciated!