Last active
November 15, 2024 12:05
-
-
Save mrlesmithjr/c42ebb99a01e8eeeca6a5eb4fa52f852 to your computer and use it in GitHub Desktop.
dig results to parsable json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
try: