Skip to content

Instantly share code, notes, and snippets.

@marduc812
Last active September 5, 2019 19:17
Show Gist options
  • Save marduc812/42dc5a11f5d1042a728680410eaa6fb7 to your computer and use it in GitHub Desktop.
Save marduc812/42dc5a11f5d1042a728680410eaa6fb7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Path for the Forward DNS records zip
source="/root/Downloads/2019-01-25-1548374703-fdns_any.json.gz"
# Input with dot in front
in=.$1
#Check if JQ is installed
if hash jq 2>/dev/null; then
# Execute slightly modified command, without the if statement. The previous IF statement was breaking the syntax because of multiple backslashes.
zcat $source | grep -F $in\" | jq -crM '.name' | grep $in | sort | uniq | tee -a $1.list
else
echo "jq parser was not found on your system."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment