title: How to script bulk nslookups
body: <p>I have a list of several million domain names and I want to see if they are available or not.</p>
  
  <p>I tried pywhois first but am getting rate limited. As I don't need an authoritative answer, I thought I would just use nslookup. I am having trouble scripting this though.</p>
  
  <p>Basically, what I want to do is, if the domain is registered, echo it. What I'm getting is <strong>grep: find”: No such file or directory</strong> . I think its something easy and I've just been looking at this for too long...</p>
  
  <pre><code>#!/bin/bash
  START_TIME=$SECONDS
  for DOMAIN in `cat ./domains.txt`;
  do
      if ! nslookup $DOMAIN | grep -v “can’t find”; then
          echo $DOMAIN
      fi
  done
  echo ELAPSED_TIME=$(($SECONDS - $START_TIME))
  </code></pre>