Shell variable in awk script
I need to export some Varibales in Shell like (KSH )
export CORE=1 export DODDY=0 then I need to call these variables in the awk #!/bin/awk -f BEGIN { if ( $CORE ~ "1" ) { print "Core is right one " } But awk doesnot understand the variables and I am not getting the right results Can you help me out Thanks Rohini |
Try awk's -v option
|
In awk the environment variables can be accessed through the associative array ENVIRON:
Code:
#!/bin/awk -f |
Quick glance:
The -f flag says to get code from a file, but you have the code inline. "~" means "ERE match". Why not just use "==" ? |
All times are GMT -5. The time now is 04:20 PM. |