how to count IPs in use

Peter Laws plaws at ou.edu
Wed Oct 7 16:17:00 UTC 2009


David Forrest wrote:

> Peter, Add a match statement for the subnet like this:
> 
> awk '/^lease / { curlease =2; } /^ binding state/ { match(curlease,
> /192.168.102/) && lstates[curlease] =3; } END { for (curl in lstates)
> {tstates[lstates[curl]]++; } for (curs in tstates) { print curs,
> tstates[curs]; } }' /var/db/dhcpd.leases

Thanks - this did it.  The net in question is a /19, so my regular 
expression was a little different, but it gives the answer I need.

Thanks, all!


-- 
Peter Laws / N5UWY
National Weather Center / Network Operations Center
University of Oklahoma Information Technology
plaws at ou.edu
-----------------------------------------------------------------------
Feedback? Contact my director, Craig Cochell, craigc at ou.edu. Thank you!



More information about the dhcp-users mailing list