awk question about BEGIN patttern
I have a awk script with the following BEGIN pattern
BEGIN { upper = "PNBRQK" lower = "pnbrqk" getline < "lance1.tmp" cor = substr($0,77,1) } I ca use cor inside other patterns when I run the script over lance1.tmp but I woul like to use it when I run the script over other files. How can I do that. Thanks in advance for any help Gaspar |
Use ARGV and ARGC
awk -f your-script.awk name-of-file-to-process
BEGIN { upper = "PNBRQK" lower = "pnbrqk" getline < ARGV[1] cor = substr($0,77,1) } ARGV[0] contains "awk" Use ARGC to see that you have two parameters, one for "awk" and one for your file name. |
All times are GMT -5. The time now is 02:01 PM. |