oldwhtman
Programmer
- Feb 28, 2014
- 4
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> <file-name>
but it says 'var is not a valid variable name.
I've tried everything I could think of that seemed logical, but nothing works.
#!/bin/gawk -v "var=$1" -f
begin {
print "var=" var
}
Using the command:
>myscript.awk <value> <file-name>
but it says 'var is not a valid variable name.
I've tried everything I could think of that seemed logical, but nothing works.