Digging to the final IP

Jim Young jyoung at gsu.edu
Wed Oct 22 04:46:36 UTC 2014


On 10/22/14 12:08 AM, "LuKreme" <kremels at kreme.com> wrote:

>> On 21 Oct 2014, at 19:20 , Dave Knight <dave at knig.ht> wrote:
>> 
>> $ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
>> 216.235.14.46
>
>Interesting. This works for me:
>
>dig +noall +answer home.kreme.com in a | egrep '\tA' | cut -f5
>
>but on your example, it requires -f6
>
>And yet, the outputs appear to have the same number of fields.
>
> $ dig +noall +answer www.kreme.com in a
>www.kreme.com.		21139	IN	CNAME	cerebus.kreme.com.
>cerebus.kreme.com.	21141	IN	A	23.24.150.141
> $ dig +noall +answer dave.knig.ht in a
>dave.knig.ht.		13916	IN	CNAME	sb.sanxion.org.
>sb.sanxion.org.		222	IN	A	216.235.14.46
>
>Very odd.

Subtle formatting difference for human consumption.  There are a variable
number of ASCII TABs inserted to visually align fields.

$ dig +noall +answer www.kreme.com in a | egrep '\tA' | cat -t
cerebus.kreme.com.^I21409^IIN^IA^I23.24.150.141

$ dig +noall +answer dave.knig.ht in a | egrep '\tA' | cat -t
sb.sanxion.org.^I^I299^IIN^IA^I216.235.14.46

There is only one ASCII TAB (represented as ^I with cat -t) between
"cerebus.kreme.com." and "21409." but two ASCII TABs between
"sb.sanxion.org." and "299".  I'm guessing a very short name might
result in three!

This is where output generated for human consumption can be tricky to
parse.

Best regards,

Jim Y.



More information about the bind-users mailing list