Re: help with AWk

2008-09-27 Thread Wayne Sierke
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.

Re: help with AWk

2008-09-27 Thread Eric Schuele
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

Re: help with AWk

2008-09-27 Thread Josh Carroll
> dig +short -x 1.2.3.4 | awk '{if ( $0 == "" ) {print "PTR_NUL" } else {print > $0 } }' If you run the dig command without the pipe, it should give you an idea of why what you're trying is not working. > dig +short -x 1.2.3.4 | wc 0 0 0 Josh _