Created
May 11, 2013 14:51
-
-
Save Temikus/5560165 to your computer and use it in GitHub Desktop.
Awk script to make the dhcp.leases more readable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk ' { out = ""} \ | |
{ $1=="lease"||$1=="client-hostname" ? out=" " $2 : out=out } \ | |
{ $1=="binding"||$1=="hardware" ? out= " " $3: out=out } \ | |
{ $1=="ends"? out=" " $3 " " $4: out=out } \ | |
{ $1=="}"? out="\n": out=out } \ | |
{ printf out," " }' dhcpd.leases \ | |
| grep active \ | |
| sed -e s/'[{};" ]'/\ /g \ | |
| awk '{ printf "%-15s %-17s %-10s %-5s\n", $1, $5, $2, $3 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment