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>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



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