Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2008 22:52:10 -0800
From:      Gary Kline <kline@thought.org>
To:        Polytropon <freebsd@edvax.de>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: for awk experts only.
Message-ID:  <20081130065209.GA98518@thought.org>
In-Reply-To: <20081130061731.0691f5ea.freebsd@edvax.de>
References:  <20081130045944.GA94896@thought.org> <20081130061104.f595db7e.freebsd@edvax.de> <20081130061731.0691f5ea.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081130065209.GA98518>