From owner-freebsd-questions@FreeBSD.ORG Sun Sep 28 04:12:10 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 882EB1065693 for ; Sun, 28 Sep 2008 04:12:10 +0000 (UTC) (envelope-from e.schuele@computer.org) Received: from smtpauth19.prod.mesa1.secureserver.net (smtpauth19.prod.mesa1.secureserver.net [64.202.165.30]) by mx1.freebsd.org (Postfix) with SMTP id 532A48FC1C for ; Sun, 28 Sep 2008 04:12:10 +0000 (UTC) (envelope-from e.schuele@computer.org) Received: (qmail 11957 invoked from network); 28 Sep 2008 03:45:29 -0000 Received: from unknown (96.226.72.228) by smtpauth19.prod.mesa1.secureserver.net (64.202.165.30) with ESMTP; 28 Sep 2008 03:45:29 -0000 Message-ID: <48DEFDD7.1010908@computer.org> Date: Sat, 27 Sep 2008 22:45:27 -0500 From: Eric Schuele User-Agent: Thunderbird 2.0.0.17 (X11/20080927) MIME-Version: 1.0 To: Len Conrad References: <200809280458484.SM01744@TX2.Go2France.com> In-Reply-To: <200809280458484.SM01744@TX2.Go2France.com> X-Enigmail-Version: 0.95.2 OpenPGP: url=http://www.ravenlock.us/keys/pub_schuele.pgp Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7CA434B238F4C80407FF238F" Cc: freebsd-questions@freebsd.org Subject: Re: help with AWk X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Sep 2008 04:12:10 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7CA434B238F4C80407FF238F Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 09/27/2008 22:06, Len Conrad wrote: > The logic desired if >=20 > If IP has no PTR, print "PTR_NUL", else print the PTR. >=20 >=20 > dig +short -x 1.2.3.4 | awk '{if ( $0 =3D=3D "" ) {print "PTR_NUL" } el= se {print $0 } }' >=20 > ... 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 =3D=3D 1 ) {print "PTR_NUL" } else {print $2 } }' >=20 > thanks > Len >=20 >=20 >=20 >=20 >=20 > ______________________________________________ > IMGate OpenSource Mail Firewall www.IMGate.net >=20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd= =2Eorg" >=20 >=20 --=20 Regards, Eric --------------enig7CA434B238F4C80407FF238F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEUEARECAAYFAkje/dcACgkQngSDRM3IXUp9igCguwpQjnhZG2wfdph9s1qKFD6I 77kAmLs/98+ZDYvHaouu2LY8CEPK+EY= =EE91 -----END PGP SIGNATURE----- --------------enig7CA434B238F4C80407FF238F--