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.) > > The following fails: > > wn foot -over |grep Overview |awk > {if(!strcmp($3,"noun"))$3="n."; '{printf("%s %s\n", $4, $3);}}'
Of course. You cannot have $3 as a lvalue (read: You cannot change its value). > If there are any shortcuts, please clue me in! Don't make it more complicated than it is. :-) % wn foot -over | grep "Overview" | awk \ '{ printf("%s %s\n", $4, gsub("noun", "n.", $3)); }' And the more I think about it, the more I believe there are much easier ways to do this. But I'm sure the magic of how it works just opened up to you. Sidenote: I wouldn't consider myself as an AWK expert allthough I did abuse AWK lately to implement a stastistical evaluation program for blood sugar data into a PDF file with diagrams a CVS file, involving gnuplot and \LaTeX{}. =^_^= -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"