Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

List whois servers on Mac OS X (See related posts)

defaults domains | tr ',' '\n' | nl
defaults domains | tr ',' '\n' | grep -i network
defaults find network | egrep '^Found'
defaults find whois | egrep '^Found'
defaults find server | egrep '^Found'

defaults read com.apple.NetworkUtility
defaults read ~/Library/Preferences/com.apple.NetworkUtility NUWhoisSelectedServer
defaults read com.apple.NetworkUtility NUWhoisServers | awk -F '"' '/"/{print $2}' | nl

defaults read com.apple.NetworkUtility NUWhoisServers | awk -F '"' '/"/{print $2}' | xargs -I '{}' \
     bash -c 'ipaddr="$(/usr/bin/dig +short {})"; printf "%s\n" "${ipaddr//[[:cntrl:]]/, }"'

defaults read com.apple.NetworkUtility NUWhoisServers | awk -F '"' '/"/{print $2}' | xargs -I '{}' \
     bash -c 'ipaddr="$(/usr/bin/dig +short {})"; printf "%s  --  %s\n" "{}" "${ipaddr//[[:cntrl:]]/, }"'

You need to create an account or log in to post comments to this site.