Date: Sun, 08 Feb 2004 19:49:46 -0500 From: "yo _" <exhausted01@hotmail.com> To: freebsd-questions@freebsd.org Subject: RE: How to query the computer's ip address? Message-ID: <Law9-F807DaJHFzrK0p000214a6@hotmail.com>
next in thread | raw e-mail | index | archive | help
>Hi, > >Silly question, maybe, but is there a simple command to query the >computer's >ip address? Something similar to 'hostname' for finding the computer's >hostname. >I need the four dot-separated ip numbers. > >I can analyze the output of 'ifconfig', but isn't there an easier way. For the sake of looking for a "command" that might do this, i whipped up this long one-liner: ifconfig | perl -nle 'print $1 if(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)' note that this will print the first ip address it finds of each line seperated by a newline, so be prepared to handle more than one. -rian _________________________________________________________________ Find great local high-speed Internet access value at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Law9-F807DaJHFzrK0p000214a6>