1 2 3 4 5 6 7
#!/bin/bash if [[ "$#" != "1" ]]; then echo "usage: $0 <hostname>" else dig +short "$1" | awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print $0}' | xargs -I _ dig +short -x _ fi