On Sat, 29 Nov 2008 20:59:51 -0800, Gary Kline [EMAIL PROTECTED] wrote:
wordnet/wn prints the string noun out whereas I'd rather it simply
printed n. Is there a way of making this substitution using awk?
(I've never used awk except as a cmdline filter.)
The following
On Sun, Nov 30, 2008 at 11:47:29AM +0200, Giorgos Keramidas wrote:
On Sat, 29 Nov 2008 20:59:51 -0800, Gary Kline [EMAIL PROTECTED] wrote:
wordnet/wn prints the string noun out whereas I'd rather it simply
printed n. Is there a way of making this substitution using awk?
(I've
On Sun, 30 Nov 2008 09:15:15 -0800, Gary Kline [EMAIL PROTECTED] wrote:
On Sun, Nov 30, 2008 at 11:47:29AM +0200, Giorgos Keramidas wrote:
Don't do this with a long stream of if/else/.../else blocks. AWK is
a pattern based rule-language. You can apply different blocks of
code to lines that
wordnet/wn prints the string noun out whereas I'd rather it simply
printed n. Is there a way of making this substitution using awk?
(I've never used awk except as a cmdline filter.)
The following fails:
wn foot -over |grep Overview |awk
Good morning!
On Sat, 29 Nov 2008 20:59:51 -0800, Gary Kline [EMAIL PROTECTED] wrote:
wordnet/wn prints the string noun out whereas I'd rather it simply
printed n. Is there a way of making this substitution using awk?
(I've never used awk except as a cmdline filter.)
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. :-)
--
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe,
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
On Sat, 29 Nov 2008 22:52:10 -0800, Gary Kline [EMAIL PROTECTED] wrote:
What you have above prints:
foot 1 // noun
foot 0 // verb
so doesn't work entirely, but is a good start.
I'm so stupid. gsub() does not return the result of the
substitution (as, for example,
On Sun, Nov 30, 2008 at 08:07:21AM +0100, Polytropon wrote:
On Sat, 29 Nov 2008 22:52:10 -0800, Gary Kline [EMAIL PROTECTED] wrote:
What you have above prints:
foot 1 // noun
foot 0 // verb
so doesn't work entirely, but is a good start.
I'm so stupid. gsub()