LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   using awk (https://www.linuxquestions.org/questions/linux-general-1/using-awk-541004/)

vkmgeek 03-27-2007 07:45 AM

using awk
 
Hello,
I m confused a lil bit.

I am taking one variable in my script file which is an integer value.
Now, I want to use this value in awk command. How can I? Because when I take any variable in awk, it takes it as a local variable there only.

e.g,
I want to compare all emp's salary with some value.

awk -F":" '$2 > ValueToCompare {printf "%s \n",$0}' TCPCounterTemp.log > BumpingCounter.log;

This ValueToCompare I want to take as a variable which is declared outside awk. But I am not able to do it as I mentioned awk takes any variable as local there and initializes to zero.

Plllllease Helpppppppppp

jschiwal 03-27-2007 09:24 AM

Read the "info gawk" manual. Section 6.2 is called "Using Shell Variables in Programs".
I would highly recommend installing the gawk source and using the "make pdf" target to produce the printable documentation "Gawk: Effective Awk Programming".


All times are GMT -5. The time now is 11:43 PM.