Skip to content

Instantly share code, notes, and snippets.

@glazeus
Created June 29, 2018 10:56
Show Gist options
  • Select an option

  • Save glazeus/676b9855fb8bdc8b239f1c92bec0f21d to your computer and use it in GitHub Desktop.

Select an option

Save glazeus/676b9855fb8bdc8b239f1c92bec0f21d to your computer and use it in GitHub Desktop.
get-ip-from-srv-record
i=0; for srvrecord in `host -t SRV $SrvServiceDiscoveryServiceDns | awk '{ print substr($8, 1, length($8)-1)}'`; do arr[$i]=$(host $srvrecord | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])'); echo "arr[$i] is ${arr[$i]}"; i=$(expr $i + 1); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment