From owner-freebsd-questions@FreeBSD.ORG Mon Aug 18 12:33:08 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D77DC1065689 for ; Mon, 18 Aug 2008 12:33:08 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id A3F1D8FC16 for ; Mon, 18 Aug 2008 12:33:08 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-195-13-249.dynamic.qsc.de [92.195.13.249]) by mx01.qsc.de (Postfix) with ESMTP id 3C484512B1; Mon, 18 Aug 2008 14:33:05 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id m7ICX5VD001620; Mon, 18 Aug 2008 14:33:05 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Mon, 18 Aug 2008 14:33:05 +0200 From: Polytropon To: Giorgos Keramidas Message-Id: <20080818143305.9dd7d096.freebsd@edvax.de> In-Reply-To: <87ljyvypa8.fsf@kobe.laptop> References: <20080818013328.GY44815@bunrab.catwhisker.org> <87ljyvypa8.fsf@kobe.laptop> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, David Wolfskill Subject: Re: Shell scripts: variable assignment within read loops X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2008 12:33:08 -0000 As I thought while reading your message, awk seems to be a good solution. Just a note: On Mon, 18 Aug 2008 06:29:03 +0300, Giorgos Keramidas wrote: > Would you > be ok with an awk(1) script instead of /bin/sh? It tends to be nicer > for this sort of thing, i.e.: > > [...] > $ netstat -nibd -f inet | awk -f david.awk You could start your awk skript with #!/usr/bin/awk and give it +x attribute, as well as adding the desired source command "netstat -nibd -f inet" to the script, using awk's system() function, so you can start it more easily or use it in combination with other commands. % ./netstuff.awk -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...