Date: Sun, 28 Sep 2008 16:01:30 +0930 From: Wayne Sierke <ws@au.dyndns.ws> To: Len Conrad <LConrad@Go2France.com> Cc: freebsd-questions@freebsd.org Subject: Re: help with AWk Message-ID: <1222583490.2581.191.camel@predator-ii.buffyverse> In-Reply-To: <200809280458484.SM01744@TX2.Go2France.com> References: <200809280458484.SM01744@TX2.Go2France.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2008-09-27 at 22:06 -0500, 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. > > thanks > Len > dig +short -x 10.0.0.1 | awk '{print $0} END {if(NR==0) print "PTR_NUL"}' PTR_NUL > dig +short -x 69.147.83.33 | awk '{print $0} END {if(NR==0) print "PTR_NUL"}' www.freebsd.org.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1222583490.2581.191.camel>