Digging to the final IP

Sam Wilson Sam.Wilson at ed.ac.uk
Thu Oct 23 14:17:49 UTC 2014


In article <mailman.1128.1414072988.26362.bind-users at lists.isc.org>,
 Bob Harold <rharolde at umich.edu> wrote:

> Anytime you see 'grep' and 'cut' used together, they can usually be
> shortened to just 'awk', which requires starting one less process.  And if
> this case it splits fields the way a users sees them, so the same code
> works in both cases:
> 
> $ dig +noall +answer home.kreme.com in a | awk '/[\t ]A[\t ]/ {print $NF}'
> 23.24.150.141
> $ dig +noall +answer  dave.knig.ht in a | awk '/[\t ]A[\t ]/ {print $NF}'
> 216.235.14.46

$ dig +noall +answer cancer.ucs.ed.ac.uk | perl -ne ' /\sA\s/ && do { 
@_=split; print "$_[$#_]\n" }' 
129.215.166.13
129.215.200.7

Sam

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


More information about the bind-users mailing list