From owner-freebsd-questions Sun Mar 9 23:13:13 2003 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 6AC0137B401 for ; Sun, 9 Mar 2003 23:13:12 -0800 (PST) Received: from priv-edtnes10-hme0.telusplanet.net (outbound02.telus.net [199.185.220.221]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5A3E43F75 for ; Sun, 9 Mar 2003 23:13:10 -0800 (PST) (envelope-from viktorlazlo@telus.net) Received: from [192.168.1.100] ([64.180.182.172]) by priv-edtnes10-hme0.telusplanet.net (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP id <20030310071310.VMNJ26597.priv-edtnes10-hme0.telusplanet.net@[192.168.1.100]>; Mon, 10 Mar 2003 00:13:10 -0700 Date: Sun, 9 Mar 2003 23:13:06 -0800 (PST) From: Viktor Lazlo X-X-Sender: viktorlazlo@a3ij25fvy80j.bc.hsia.telus.net To: Michael Collette Cc: FreeBSD Mailing Lists Subject: Re: identifying my network address In-Reply-To: <200303092130.22748.metrol@metrol.net> Message-ID: <20030309222546.K20073-100000@a3ij25fvy80j.bc.hsia.telus.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 9 Mar 2003, Michael Collette wrote: > It's ugly. It won't work if you multiple NICs. It may just work for what you > need just the same. > > echo `ifconfig | grep broadcast | cut -d" " -f2`":0.0" > > This takes the output of ifconfig and parses it just a wee bit with grep and > cut. I use something very similar to this in a script that changes my > network settings for my laptop on the fly. All you need to do to deal with multiple NICs is specify which interface you want to poll. Awk can also combine the actions of both grep and cut in the example into a single process: echo `ifconfig xl0 | awk '/broadcast/ { print $2":0.0" }'` Cheers, Viktor To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message