I wrote a awk script file and define some global variables after BEGIN option:
BEGIN {
cell = "";
alarm = "";}
when i run the command:
awk -f awk_script inputfile
The results are as expected. But when I put awk script into a shell script. Global variables couldn't be understand.
I don't want to use the formatting:
awk -v cell=123 awk_script inputfile . Because the global variables can't be changed many times before finishing awk_script ( with -v option: golbal variables're alway fixed).
Who can solve this for us?
Thanks