From owner-freebsd-questions@FreeBSD.ORG Mon Apr 28 15:31:07 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E49B237B408 for ; Mon, 28 Apr 2003 15:31:07 -0700 (PDT) Received: from ares.sublevel3.org (ares.sublevel3.org [195.119.0.175]) by mx1.FreeBSD.org (Postfix) with SMTP id 2730843FBD for ; Mon, 28 Apr 2003 15:31:06 -0700 (PDT) (envelope-from csl@ares.sublevel3.org) Received: (qmail 2183 invoked by uid 502); 28 Apr 2003 22:31:04 -0000 Date: Tue, 29 Apr 2003 00:31:04 +0200 From: Christian Stigen Larsen To: freebsd-questions@freebsd.org Message-ID: <20030428223104.GA1043@sublevel3.org> References: <01de01c30dd1$5c5d4c10$6300a8c0@fmelectro.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01de01c30dd1$5c5d4c10$6300a8c0@fmelectro.co.za> User-Agent: Mutt/1.4.1i Subject: Re: extract IP address and feed it into a command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2003 22:31:08 -0000 Quoting DJ Boris (dj_boris@mail.ru): | I need to extract my IP address [...] assigned by my ISP [...] | I know that my IP always starts with zzz.zzz and if I run | | "ifconfig | grep zzz.zzz" >From the top of my head, I don't know any programs that automatically spits out IP addresses. But you could always combine ifconfig with awk. Say the interface you need to query is xl0, then you might do: $ ifconfig xl0 inet | awk '/inet/ {print $2}' This prints "10.0.0.2", which is the IP assigned to my box by the DHCP server. I don't know if this is exactly what you need, but at least it should give you some idea on using awk in such cases. Play around, and you'll probably get something working (or, possibly, someone else on the list gives you some better alternative). Dig up some info on awk if you've never heard about it before. -- Christian Stigen Larsen -- http://sublevel3.org/~csl/ -- mob: +47 98 22 02 15