Re: for awk experts only.

2008-11-30 Thread Giorgos Keramidas
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

Re: for awk experts only.

2008-11-30 Thread Gary Kline
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

Re: for awk experts only.

2008-11-30 Thread Giorgos Keramidas
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

for awk experts only.

2008-11-29 Thread Gary Kline
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

Re: for awk experts only.

2008-11-29 Thread Polytropon
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.)

Re: for awk experts only.

2008-11-29 Thread Polytropon
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,

Re: for awk experts only.

2008-11-29 Thread Gary Kline
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

Re: for awk experts only.

2008-11-29 Thread Polytropon
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,

Re: for awk experts only.

2008-11-29 Thread Gary Kline
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()