From owner-freebsd-questions@FreeBSD.ORG Mon Aug 18 12:55:55 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 17F34106567B for ; Mon, 18 Aug 2008 12:55:55 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 906DF8FC1E for ; Mon, 18 Aug 2008 12:55:54 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl22-219.kln.forthnet.gr [77.49.149.219]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m7ICtFlt019034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 18 Aug 2008 15:55:21 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m7ICtFd3011917; Mon, 18 Aug 2008 15:55:15 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m7ICtEZt011916; Mon, 18 Aug 2008 15:55:14 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Polytropon References: <20080818013328.GY44815@bunrab.catwhisker.org> <87ljyvypa8.fsf@kobe.laptop> <20080818143305.9dd7d096.freebsd@edvax.de> Date: Mon, 18 Aug 2008 15:55:14 +0300 In-Reply-To: <20080818143305.9dd7d096.freebsd@edvax.de> (Polytropon's message of "Mon, 18 Aug 2008 14:33:05 +0200") Message-ID: <87wsielbyl.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: m7ICtFlt019034 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.833, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.57, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No 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 List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2008 12:55:55 -0000 On Mon, 18 Aug 2008 14:33:05 +0200, Polytropon wrote: > 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 That's an option, but piping *to* awk may be slightly trickier then.