At Thu, 23 Oct 2014 15:17:49 +0100,
Sam Wilson wrote:
>
> In article <[email protected]>,
> Bob Harold <[email protected]> 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
Which makes it easy, in either case, to return a status value, as
Frank Bulk seemed to want.
Something like
'... {print $NF; count++} END {exit ! count}'
or
| perl -ane ' /\sA\s/ && do { print "$F[$#F]\n"; $count++ } END
{exit ! $count }'
might work.
Niall
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe
from this list
bind-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/bind-users