awk & variables
Arnold D. Robbins {EUCC}
arnold at mathcs.emory.edu
Sat Jun 3 04:56:11 AEST 1989
In article <23206 at dhw68k.cts.com> jaff at dhw68k.cts.com (Mark Jaffe) writes:
>Awk seems to be lacking something, but maybe it's really there. I want to
>match a pattern that I don't know until I execute the script, so I want to
>pass in a pattern to match in a variable. [...]
In nawk (available for big bucks in S5R3.1, or for little bucks from the
toolchest), and in GNU Awk (available via anonymous ftp from prep.ai.mit.edu
and anonymous uucp from ohio-state for free) regular expression matching can
now be dyamnic. The right hand operand of ~ and !~ is treated as a string
containing a regular expression. Thus, you can do stuff like
$1 ~ $2 { ..... }
if you care to. Check out the book by Aho, Kernighan, and Weinberger, or
the GNU Awk manual (co-authored by yours truly).
Enjoy,
--
Arnold Robbins -- Emory University Computing Center | Unix is a Registered
DOMAIN: arnold at unix.cc.emory.edu | Bell of AT&T Trademark
UUCP: gatech!emoryu1!arnold PHONE: +1 404 727-7636 | Laboratories.
BITNET: arnold at emoryu1 FAX: +1 404 727-2599 | -- Donn Seeley
More information about the Comp.unix.wizards
mailing list