Skip to content

Instantly share code, notes, and snippets.

@creaktive
Created June 5, 2011 22:23
Show Gist options
  • Save creaktive/1009496 to your computer and use it in GitHub Desktop.
Save creaktive/1009496 to your computer and use it in GitHub Desktop.
list named A & CNAME records
perl -MFile::Basename '-F/\t/' -ane 'if ($F[3] =~ /^(A|CNAME)$/) { my $d = $F[0] . "." . (fileparse($ARGV, ".db"))[0]; $d =~ s/^.*\.\.//; print "$d\t$F[4]" unless $F[4] =~ /\b127\.0\.0\.1\b/ }' /var/named/*.db
#!/usr/bin/perl
use File::Basename;
LINE: while (defined($_ = <ARGV>)) {
our(@F) = split(/\t/, $_, 0);
if ($F[3] =~ /^(A|CNAME)$/) {
my $d = $F[0] . '.' . (fileparse($ARGV, '.db'))[0];
$d =~ s/^.*\.\.//;
print "$d\t$F[4]" unless $F[4] =~ /\b127\.0\.0\.1\b/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment