Skip to content

Instantly share code, notes, and snippets.

@yousefamar
Created September 3, 2015 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yousefamar/fe60d555024decf72f13 to your computer and use it in GitHub Desktop.
Save yousefamar/fe60d555024decf72f13 to your computer and use it in GitHub Desktop.
#!/bin/bash
# domain-filter.sh
# Reads URLs from stdin, writes the valid ones to stdout
# Based off of http://linuxconfig.org/check-domain-name-availability-with-bash-and-whois
# @author Yousef Amar <yousef@amar.io>
while read line
do
whois "$line" | grep -Eq '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri'
if [ $? -eq 0 ]; then
echo "$line"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment