Tente isto:
gawk -F, '
# spawns nslookup as a coprocess, passes the IP into its stdin
# then reads the output of the coprocess to find the hostname
function get_name(ip, line, name) {
name = "UNRESOLVED"
print ip |& "nslookup"
close("nslookup", "to")
while (("nslookup" |& getline line) > 0) {
if (match(/name =(.+)\.uncc\.edu\./, line, m))
name = m[1]
}
close("nslookup")
return name
}
{ print , get_name(), , , , , }
' "" > "$outfile"
ref: link