Hey everyone!
I am very new to this so many apologies for such an elementary question. Have searched for 3 days online and cannot seem to find a "solution" to problem here.
Trying to use GAWK in Windows environ. I have a bat file created that calls GAWK.
What I need to do is pass a variable that I have set in the bat file over to GAWK.
Right now my bat file puts GAWK line in the PATH so that GAWK will work - then the bat file assigns value 'OK' to variable TEST.
I want to pass TEST variable from BAT to GAWK program (VARIABLEPASS.awk) and have VARIABLPASS.awk write out to a .txt file named VARIABLEPASS.txt
Anyone have any leads for me?
Bat file code and call I am using:
************************************************************
echo off
set PATH=%PATH%;N:\Staffviewdata\ScheduledTasks\cygwinlite
echo
set TEST=OK
echo "TEST = " %TEST%
Pause
pause
gawk -v test="$TEST" VARIABLEPASS.awk
pause
exit
************************************************************
AWK Code (VARIABLEPASS.awk)
************************************************************
{ print("test\n") > "VARIABLEPASS.txt" }
************************************************************
THANK YOU VERY MUCH FOR YOUR HELP!
I am very new to this so many apologies for such an elementary question. Have searched for 3 days online and cannot seem to find a "solution" to problem here.
Trying to use GAWK in Windows environ. I have a bat file created that calls GAWK.
What I need to do is pass a variable that I have set in the bat file over to GAWK.
Right now my bat file puts GAWK line in the PATH so that GAWK will work - then the bat file assigns value 'OK' to variable TEST.
I want to pass TEST variable from BAT to GAWK program (VARIABLEPASS.awk) and have VARIABLPASS.awk write out to a .txt file named VARIABLEPASS.txt
Anyone have any leads for me?
Bat file code and call I am using:
************************************************************
echo off
set PATH=%PATH%;N:\Staffviewdata\ScheduledTasks\cygwinlite
echo
set TEST=OK
echo "TEST = " %TEST%
Pause
pause
gawk -v test="$TEST" VARIABLEPASS.awk
pause
exit
************************************************************
AWK Code (VARIABLEPASS.awk)
************************************************************
{ print("test\n") > "VARIABLEPASS.txt" }
************************************************************
THANK YOU VERY MUCH FOR YOUR HELP!