awk :
awk '/^lease/ && !($2 in ips){ f=1; ips[$2]=$0; n=NR+5 }
f && NR <= n{
a[++c]=$0;
if (NR == n) {
if ($NF == "active;") {
for (i=1; i<7; i++) print a[i]; print ""
}
c=0
}
}' dhcpd.leases
A saída:
lease 172.231.100.152 {
starts 2 2017/11/14 14:50:41;
ends 2 2017/11/14 15:20:41;
tstp 2 2017/11/21 15:05:41;
cltt 2 2017/11/14 14:50:41;
binding state active;
lease 172.231.100.151 {
starts 2 2017/11/14 14:50:41;
ends 2 2017/11/14 15:20:41;
tstp 2 2017/11/21 15:05:41;
cltt 2 2017/11/14 14:50:41;
binding state active;