variables in awk

Gunter Steinbach steinbac at hpl-opus.HP.COM
Fri Apr 28 05:06:50 AEST 1989


    I didn't look up any book passages, but I quickly tried the following
    in K-shell:

    nawk '{a="x"; if($1 ~ a) print "match"}'
    asd
    xyz
    asx

    And sure enough, the last two input lines produced a "match" output.  So
    no problemo!

    However, I also tried the above with the "old" awk, and it produces a
    "syntax error near line line".  So you need the AT&T toolbox "nawk".  

    Hope this helps you  --  Gunter Steinbach
			     Hewlett-Packard Labs
			     gunter at hpl-opus



More information about the Comp.unix.questions mailing list