Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Sep 2008 22:45:27 -0500
From:      Eric Schuele <e.schuele@computer.org>
To:        Len Conrad <LConrad@Go2France.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: help with AWk
Message-ID:  <48DEFDD7.1010908@computer.org>
In-Reply-To: <200809280458484.SM01744@TX2.Go2France.com>
References:  <200809280458484.SM01744@TX2.Go2France.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 09/27/2008 22:06, Len Conrad wrote:
> The logic desired if
> 
> If IP has no PTR, print "PTR_NUL", else print the PTR.
> 
> 
> dig +short -x 1.2.3.4 | awk '{if ( $0 == "" ) {print "PTR_NUL" } else {print $0 } }'
> 
> ... works if PTR exist, but if no PTR, PTR_NUL doesn't print.

A workaround that does the trick...

printf "dug `dig +short -x 1.2.3.4`" | awk '{if ( NF == 1 ) {print
"PTR_NUL" } else {print $2 } }'

> 
> thanks
> Len
> 
> 
> 
> 
> 
> ______________________________________________
> IMGate OpenSource Mail Firewall www.IMGate.net
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 


-- 
Regards,
Eric



[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEUEARECAAYFAkje/dcACgkQngSDRM3IXUp9igCguwpQjnhZG2wfdph9s1qKFD6I
77kAmLs/98+ZDYvHaouu2LY8CEPK+EY=
=EE91
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48DEFDD7.1010908>