AWK Bug?
Kjell Post
kjepo at senilix.liu.se
Sun Feb 28 13:31:31 AEST 1988
Recently, Alfred Aho and Ravi Sethi wrote an article in Software,
Practice & Experience about maintaining cross references in manuscripts.
The article contained the following script:
grep -h "^\. at tag" sample | awk '
{ print "s/" $3 "/" ++value[$2] "/g" }
END { print "/^\\. at tag/d" }
' > xref.script
sed -f xref.script sample > out
However, the "/" after $3 never came out.
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).
--
-------------------------------------------------------------------------------
(Y F) = (F (Y F)) |Dept of Comp&Info Science, Linkoping Sweden
"This super-amazing, clever thing" | kjepo at majestix.liu.se
- G.J. Sussman | ...liuida!majestix.liu.se!kjepo
More information about the Comp.unix.questions
mailing list