From owner-freebsd-questions@FreeBSD.ORG Sun Nov 30 06:52:37 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 ADE611065672 for ; Sun, 30 Nov 2008 06:52:37 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (ns1.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id 789D38FC13 for ; Sun, 30 Nov 2008 06:52:37 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id mAU6qg5g040317; Sat, 29 Nov 2008 22:52:42 -0800 (PST) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Sat, 29 Nov 2008 22:52:10 -0800 (PST) Date: Sat, 29 Nov 2008 22:52:10 -0800 From: Gary Kline To: Polytropon Message-ID: <20081130065209.GA98518@thought.org> References: <20081130045944.GA94896@thought.org> <20081130061104.f595db7e.freebsd@edvax.de> <20081130061731.0691f5ea.freebsd@edvax.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081130061731.0691f5ea.freebsd@edvax.de> User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 22 years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List Subject: Re: for awk experts only. 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: Sun, 30 Nov 2008 06:52:37 -0000 On Sun, Nov 30, 2008 at 06:17:31AM +0100, Polytropon wrote: > Replying to my own message: I found a point for improvement. > Why use grep when awk can grep by itself? > > % wn foot -over | awk '/Overview/ { printf("%s %s\n", $4, gsub("noun", "n.", $3)); }' > > Ah, much better. :-) > Thanks for the clue[s], :) $3 isn't only an lvalue, it's a constant. My bad in my first try. What you have above prints: foot 1 // noun foot 0 // verb so doesn't work entirely, but is a good start. (BTW, man gsub turned up nothing, so I'm assuming thhat gsub it part of awk. And [gn]awk.) Um, no, same with nawk, gawk, awk. gary > > -- > Polytropon > From Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix http://jottings.thought.org http://transfinite.thought.org