import os
ipRange = []
for i in range(1, 254):
ipRange.append('192.168.5' + '.' + str(i))
for e in ipRange:
print os.system('nslookup ' + str(e))
This outputs the full output of nslookup for each ip - is there a way to discard the empty results and make the output look more like this?
192.168.5.5 testbox4
192.168.5.6 box3
192.168.5.8 hellobox
192.168.5.9 server2012
192.168.5.18 dnsbox
192.168.5.19 sallysbox
192.168.5.20 bobsbox
192.168.5.21 serverx