Skip to content

Instantly share code, notes, and snippets.

@radut
Forked from mrlesmithjr/dig2JSON
Created November 13, 2019 09:11
Show Gist options
  • Save radut/517fa6a083f1a44b488912c23cae6fd0 to your computer and use it in GitHub Desktop.
Save radut/517fa6a083f1a44b488912c23cae6fd0 to your computer and use it in GitHub Desktop.
dig results to parsable json
foo=$(dig google.com +nocomments +noquestion +noauthority +noadditional +nostats | awk '{if (NR>3){print}}'| jq -R 'split("\t") |{Name:.[0],TTL:.[2],Class:.[3],Type:.[4],IpAddress:.[5]}' | jq --slurp .) | jq -n --argjson v $foo '{"foo": $v}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment