#!/bin/sh
#
# Nwhois - Query the whois CGI at NSI, and strip out any extraneous crap.
#
# Gerald Combs <gerald@zing.org>

if [ "$1" = "" ]; then
  echo "Usage:" `basename $0` "<domain>"
  exit
fi

query="$1"
shift

while [ $# -gt 0 ] ; do
  query="${query}+$1"
  shift
done

lynx -dump -nolist \
  http://www.networksolutions.com/cgi-bin/whois/whois?STRING=$query | \
  awk '\
    BEGIN {doprint = 0} \
    /Search Results/       {doprint = 1} \
    /____________________/ {doprint = 0} \
    doprint >= 1 {doprint++} \
    doprint >= 6 {print} \
    '
