Posts

Showing posts with the label awk

Extract IPs from multiples websites using bash and awk

Extract IPs from multiples websites using bash and awk I'm looking for the best way to get multiples websites IPs and output them as "domain.com:","1.1.1.1" in order to achieve this I was thinking on using nslookup (not sure if is the best option but I don't want to use ping) "domain.com:","1.1.1.1" nslookup Well I was trying something like: for domain in $(cat domains.txt) do nslookup $domain 8.8.8.8 | awk '/Address: ([[:digit:]]+.){3}/{gsub(/.$/,"",$1); printf ""%s","%s"n",$1,$NF}'; done With this, I'm get this output: "Address:","64.233.190.101" "Address:","64.233.190.138" "Address:","64.233.190.100" "Address:","64.233.190.139" "Address:","64.233.190.113" "Address:","64.233.190.102" "Address:","98.137.246.8" "Address:","98.138....