Skip to content

Instantly share code, notes, and snippets.

@2bj
Created July 7, 2009 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2bj/142169 to your computer and use it in GitHub Desktop.
Save 2bj/142169 to your computer and use it in GitHub Desktop.
bash implementation of http://www.domain.kg/whois.html
#!/bin/bash
# bash implementation of http://www.domain.kg/whois.html
# @author 2bj (gml2bj gmail)
if [ $# -eq 0 ]; then
echo "pls, give me domain (*.kg)"
exit 1
fi
DOMAIN=`echo $1 | tr '[:lower:]' '[:upper:]'`
curl -s -A Firefox -e "http://www.domain.kg/whois.html" -d whois=$DOMAIN http://www.domain.kg/cgi-bin/whois.cgi | iconv -f cp1251 -t utf8 | awk 'BEGIN {l=0}
{
if($0~"<pre") {l=1}
if(l==1) {print $0}
if($0~"</pre") {l=0}
}' | sed '/<pre/d;/<\/pre/d;s/<[^>]*>//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment