Results 1 to 1 of 1
Does anyone have or know of a script that will extract information from the dhcp lease file?
I want to pull the lease date, client ( if present ) and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-17-2008 #1
dhcp lease parse
Does anyone have or know of a script that will extract information from the dhcp lease file?
I want to pull the lease date, client ( if present ) and hardware address for each entry to see who is or has been in the system.
I have been working with grep, awk and cut to try to set this up but there is more to it than I am getting figured out so far.
grep "hostname" dhcp | cut -d ";" -f1 | awk '{print $2}' ( where dhcp is a copy of the lease file )
Will list the client with "s still around the name. Do I have to do multiple passes to get the other information and can I know for certain that the information goes together? Some entries have no client info.
grep "hardware" dhcp | cut -d ";" -f1 | awk '{print $3}'
gives me the mac address
and
grep "starts" dhcp | cut -d ";" -f1 | awk '{print $3}'
gives me the date but I am not sure how to get it to list to come up all in place.
I just want to redirect the output into a file to work with.
any help would be great1 thanks
kumado


Reply With Quote
