Re: dig: single line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-03-12 at 00:39 +0000, Mike -- EMAIL IGNORED wrote:
> On Thu, 12 Mar 2009 00:35:03 +0000, Mike -- EMAIL IGNORED wrote:
> 
> > On Wed, 11 Mar 2009 19:46:53 -0430, Patrick O'Callaghan wrote:
> > 
> >> On Thu, 2009-03-12 at 00:13 +0000, Mike -- EMAIL IGNORED wrote:
> >>> On Wed, 11 Mar 2009 19:31:34 -0430, Patrick O'Callaghan wrote:
> >>> 
> >>> > On Wed, 2009-03-11 at 23:32 +0000, Mike -- EMAIL IGNORED wrote:
> >>> >> The head suggestion won't work, because in the above example, it is
> >>> >> the second line I want.
> >>> > 
> >>> > A trivial excercise for old Shell hands, e.g.
> >>> > 
> >>> >         program | head -n 2 | tail -n 1
> >>> > 
> >>> > or
> >>> > 
> >>> >         program | sed -n 2p
> >>> > 
> >>> > poc
> >>> 
> >>> Yes, but the dig command sometimes returns the result on the first
> >>> line, and sometimes on the second, so it is necessary to test what you
> >>> get.
> >> 
> >> You haven't so far said which of the lines you are interested in.
> >> Perhaps you can use grep on a pattern.
> >> 
> >> poc
> > 
> > How about:
> > 
> >    grep "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]"
> > 
> > ?
> > Can it be done more concisely?  Still, one of the numbers might exceed
> > 255 ... unlikely.
> > 
> > Mike.
> 
> I forgot the final + .

You also forgot the initial ^ and final $, without which the match could
trigger on something other than a pure IP number (unlikely in practice
but not impossible e.g. abc.1.2.3.4.example.com).

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux