Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
INPUT
bix.hu.         42433   IN  A   193.239.149.1
bix.hu.         42433   IN  MX  10 deneb.iszt.hu.
bix.hu.         42433   IN  NS  ns.iszt.hu.
bix.hu.         42433   IN  NS  ns.iszt.hu.
bix.hu.         42433   IN  NS  ns-s.nic.hu.
bix.hu.         42433   IN  NS  ns-s.nic.hu.
bix.hu.         42433   IN  SOA ns.iszt.hu. hostmaster.iszt.hu. 2011053000 28800 7200 604800 14400

OUTPUT
bix.hu.         IN  A   193.239.149.1
bix.hu.         IN  MX  10 deneb.iszt.hu.
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
bix.hu.         IN  SOA ns.iszt.hu. hostmaster.iszt.hu. 2011053000 28800 7200 604800 14400

using bash, sed, awk, etc. How??

actually it's just an output from:

dig -t any bix.hu | egrep -v "^;;|^;|^$" | sort

I just don't want the TTL column.. [because I want to sha256sum the output, and in this way I can check that the DNS settings are modified or not, but if the TTL keeps decreasing it ruins the sha256sum] - it will be just a checker script..

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

KISS and use the +nottlid option? man dig.

-----[ 16:44:51 ] (!4302) [ :-) ] janmoesen@janbookpro ~ 
$ dig -t any bix.hu | egrep -v "^;;|^;|^$" | sort
bix.hu.         43113   IN  A   193.239.149.1
bix.hu.         43113   IN  MX  10 deneb.iszt.hu.
bix.hu.         43113   IN  NS  ns-s.nic.hu.
bix.hu.         43113   IN  NS  ns.iszt.hu.
bix.hu.         43113   IN  SOA ns.iszt.hu. hostmaster.iszt.hu. 2011053000 28800 7200 604800 14400
-----[ 16:44:53 ] (!4303) [ :-) ] janmoesen@janbookpro ~ 
$ dig +nottlid -t any bix.hu | egrep -v "^;;|^;|^$" | sort
bix.hu.         IN  A   193.239.149.1
bix.hu.         IN  MX  10 deneb.iszt.hu.
bix.hu.         IN  NS  ns-s.nic.hu.
bix.hu.         IN  NS  ns.iszt.hu.
bix.hu.         IN  SOA ns.iszt.hu. hostmaster.iszt.hu. 2011053000 28800 7200 604800 14400

You should really check out the documentation. For example, you can tell dig to only print the relevant info, so that grepping is not necessary.

share|improve this answer
add comment

cut(1) is your friend:

dig -t any bix.hu | egrep -v "^;;|^;|^$" | sort | cut -c1-16,22-
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.