Thanks again for your time and promptness in helping me . But your solution seems a bit complex, but informative. I didn't realize I could delete ARGV. That is good to know. However, I think a simpler solution for my purposes would be to utilize the fact that a parameter containing the "="...
The script fragment I wrote in my original post. However, thinking it wasn't relevent, I left out the detail block, which apparently changes how the parameters are interpreted. Here's my example again with detail processing:
#!/bin/gawk -v "var=$1" -f
begin {
print "var=" var
}
{
print
}
Thanks, feherke.ga, but this does not work when processing a text file. My example omitted the detail procesccing. Your example works because there is no 'detail' processing of a text file. My script tries to interpret all parameters as files to be processed.
I've spent as couple hours searching in vain for an example of how to pass parameters to an executable awk script. Can anyone lead me to such an example? I tried the following syntax:
#!/bin/gawk -v "var=$1" -f
begin {
print "var=" var
}
Using the command:
>myscript.awk <value>...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.