Subject: | |
From: | |
Reply To: | |
Date: | Wed, 24 Oct 2001 07:11:48 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Donna,
"amatch" is an awk variable. You can pass those in
when calling the awk program, same as you can
pass in the program name, and optionally an input
file. It has to have the on the form of "var=value".
So it's just an arbitrary name I gave the variable.
It's being passed the value of whatever the "key"
parm from my CI script is given.
So, in the first script (the CI script) I call it as follows:
KEYVAL 15
if I'm looking for a match for 15. At that point 15 is put
into the parm "key". When I call the awk program,
"key" is dereferenced by the CI so that it's value is passed
into "amatch". "amatch" is passed by the awk program
into the awk script, so that's why you see it in the KVAWK
script.
It's one of those situations where you can still rely on the
CI behavior on the same line as a posix call.
Hope that makes sense! :-)
Ron
-----Original Message-----
From: Donna Garverick [mailto:[log in to unmask]]
Sent: Tuesday, October 23, 2001 7:49 PM
To: Ron Wuerth
Cc: [log in to unmask]
Subject: Re: [HP3000-L] mpe scripting and file extracts
Ron Wuerth wrote:
> Okay Donna,
drum roll, please :-)
> Here's the awk solution
> (thanks again Ken, Jeff & Mark)
(absolutely!)
> KEYVAL is real simple
>
> PARM key=0
> SETVAR KEYVAL 0 #just for testing can get rid of it
> SHOWVAR KEYVAL #just for testing can get rid of it
> /bin/awk "-f KVAWK amatch=!key" < DATAFILE
> SHOWVAR KEYVAL #just for testing can get rid of it
'amatch'?? (where is that in o'reilly's unix cd? i can't find
it....)
> Here is KVAWK
>
> { key[++j]=$1; val[j]=$2; }
> END {
> for(i in key) {
> if (key[i]==amatch) {
> system("callci SETVAR KEYVAL \\'"val[i]"\\'");
> }
> }
> }
ok....i'm lost. in the first script you're passing in(??)
amatch...then why is it in the awk 'program'?
> HTH
it sure does. thank you!! - d
--
Donna Garverick Sr. System Programmer
925-210-6631 [log in to unmask]
>>>MY opinions, not Longs Drug Stores'<<<
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|