Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!amdcad!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: An awk question or two... Message-ID: <28084@sun.uucp> Date: Tue, 15-Sep-87 15:30:46 EDT Article-I.D.: sun.28084 Posted: Tue Sep 15 15:30:46 1987 Date-Received: Thu, 17-Sep-87 06:43:53 EDT References: <3931@well.UUCP> <27817@sun.uucp> <90@aimt.UUCP> Distribution: na Organization: Sun Microsystems, Inc. - Mtn View, CA Lines: 24 Keywords: awk ranges > Actually, according to: "Awk - A Pattern Scanning and Processing Language" > by Aho Kernighan and Weinberger (Second Edition), "A variety of expressions > may be used as patterns: regular expressions, arithmetic relational > expressions, *string-valued expressions*, and arbitrary boolean > combinations of these." Now I haven't been able to make use of variables > as "string-valued expressions" in the pattern part of an awk statement, > but I haven't been able to find anything that says they can't be. In the "awk" document in the S5R3 Programmer's Guide (I've found the S5 "awk" documentation to be much nicer than the old documentation, and the S5R3 "awk" isn't much changed from the "awk" that went out on the V7 addendum tape, which is basically the same one that's in 4BSD), the list above is missing the phrase "string-valued expressions". Sounds like the documentation you cite either 1) described a version of "awk" other than the one most people have or 2) has an error in it. > I think the question boils down to, "How can I force awk to use the value of > the variable: comvar instead of the string that is the variable's name?" The answer is "you can't; sorry, the documentation lied". -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)