Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!pacbell!sactoh0!siva!mark
From: mark@siva.UUCP (Mark Charles Marsh)
Newsgroups: comp.unix.wizards
Subject: Re: awk & variables
Summary: This works...
Keywords: awk variables
Message-ID: <10@siva.UUCP>
Date: 3 Jun 89 06:19:11 GMT
References: <23206@dhw68k.cts.com> <10980@yendor.phx.mcd.mot.com>
Organization: siva - Sacramento,CA
Lines: 24
> In article <23206@dhw68k.cts.com> jaff@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. I can't get this to work! Here's
I am using this and it works.
Try:
| awk -f VAR=$THING -
or
awk -f VAR=$THING
and reference your variable in your awk program as:
printf("var=[%s]\n",VAR);
Good luck.
--
"Off by an order of magnitude; my specialty!" |\ /| | / | \ /
...!ames!pacbell!sactoh0!siva!uumgr | \ / | | / | \ /
...!csusac!unify!siva!uumgr | \/ | | \ | \ /
Mark Marsh | | | \ | \/