AWK Bug?

Dean Okamura dean at devvax.JPL.NASA.GOV
Wed Mar 2 02:10:16 AEST 1988


<729 at senilix.liu.se> wrote that:
> Recently, Alfred Aho and Ravi Sethi wrote an article in Software, 
> Practice & Experience about maintaining cross references in manuscripts.
>
> ...
> 
> For some reason, inserting 'foo' after the "/" did the trick:
> 
> 	grep -h "^\. at tag" sample | awk '
> 			{ print "s/" $3 "/" foo ++value[$2] "/g" }
> 		END	{ print "/^\\. at tag/d" }
> 	' > xref.script
> 	sed -f xref.script sample > out
> 
> This was on a Sun 3/50 running SunOS 3.2 (UNIX 4.2BSD).

I encountered the same problem but I used parentheses around the
++value[$2] which looks a little better:

			{ print "s/" $3 "/" (++value[$2]) "/g" }
-- 
Dean Okamura
Jet Propulsion Laboratory, M/S 301-260A, 4800 Oak Grove Drive,
Pasadena, CA 91109, USA (818) 354-1490
Please send returned mail to dean at devvax.JPL.NASA.GOV.
There seems to be mail problems with jpl-devvax.



More information about the Comp.unix.questions mailing list