Path: utzoo!mnetor!uunet!mcvax!enea!liuida!kjepo From: kjepo@senilix.liu.se (Kjell Post) Newsgroups: comp.unix.questions Subject: AWK Bug? Message-ID: <729@senilix.liu.se> Date: 28 Feb 88 03:31:31 GMT Organization: CIS Dept, Univ of Linkoping, Sweden Lines: 25 Keywords: awk 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 "^\.@tag" sample | awk ' { print "s/" $3 "/" ++value[$2] "/g" } END { print "/^\\.@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 "^\.@tag" sample | awk ' { print "s/" $3 "/" foo ++value[$2] "/g" } END { print "/^\\.@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@majestix.liu.se - G.J. Sussman | ...liuida!majestix.liu.se!kjepo