Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Dec 25, 2011
@fyfe fyfe Fix and improve the output of rsdns-list.sh
Fix the output of MX and TXT records.

Output the domain and records list as a table.

The domains table is sorted by domain name, and the records table
is sorted by record type then by name.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
84c0b46
Commits on Dec 28, 2011
@linickx Merge pull request #5 from fyfe/rsdns-list
Fix and improve the output of rsdns-list.sh
24bd698
Showing with 26 additions and 30 deletions.
  1. +26 −30 rsdns-list.sh
View
56 rsdns-list.sh
@@ -30,46 +30,42 @@ function usage () {
#prints out the domains associated with an account.
function print_domains () {
-
+
get_domains
-
-
- for i in `echo $DOMAINS |awk -F, 'BEGIN { RS = ";" } ; {print}' `
- do
-
- DOMAINID=`echo $i | awk -F "\"*,\"*" '{print $2}'`
-
- DOMAINNAME=`echo $i | awk -F "\"*,\"*" '{print $1}'`
- DOMAINNAME=`echo ${DOMAINNAME:1}`
-
- printf " %s - %s \n" $DOMAINID $DOMAINNAME
- done
-
+
+ echo $DOMAINS | (
+ echo "ID|Domain"
+ awk -F, 'BEGIN { RS = ";" } { gsub(/\"/,"") ; print $2 "|" $1 }' |
+ sort -t '|' -k 2
+ ) | column -t -s '|'
+
}
#prints out the records for a given domain.
function print_records() {
-
+
check_domain
-
+
if [ $FOUND -eq 1 ]
then
-
+
get_records
-
- for i in `echo $RECORDS |awk -F, 'BEGIN { RS = ";" } ; {print}' `
- do
- NAME=`echo $i | awk -F "\"*,\"*" '{print $1}'`
- RECORDID=`echo $i | awk -F "\"*,\"*" '{print $2}'`
- TYPE=`echo $i | awk -F "\"*,\"*" '{print $3}'`
- DATA=`echo $i | awk -F "\"*,\"*" '{print $4}'`
-
- printf "%s - %s - %s - %s \n" $RECORDID $TYPE $NAME $DATA
- done
-
+
+ echo $RECORDS | (
+ echo "Record ID|Type|Name|Data"
+ awk -F, '
+BEGIN { RS = ";" }
+{
+ if ($2 ~ "^\"MX")
+ {gsub(/\"/,"") ; print $2 "|" $4 "|" $1 "|" $3, $5}
+ else
+ {gsub(/\"/,"") ; print $2 "|" $3 "|" $1 "|" $4}
+}
+ ' | sort -t '|' -k 2,3
+ ) | column -t -s '|'
+
fi
-
-
+
}
#Get options from the command line.

No commit comments for this range

Something went wrong with that request. Please try again.