Finding TinyDNS records from a file list

From V.S.V., Inc.
Jump to: navigation, search

Finding TinyDNS records from a file list

From time to time I am given huge lists of records to add/modify in TinyDNS. I wanted to have some command line tools that would tell me which records currently exist and which ones don't.

  1. Put the list of host names you are looking for in a file. For this example, I have created a file called blah in the temp directory.
  2. Change to the top level directory of your TinyDNS tree.
  3. To find the existing records, run:
    for i in `cat /tmp/blah`; do grep -irE "^.$i" */; done
  4. To find the missing records run:
    for i in `cat /tmp/blah`; do grep -qcirE "^$i" */; if [ $? -ne 0 ]; then echo "$i"; fi; done