pass variable from awk to shell script

Hello Experts,

        Actually I was searching for a solution here in this forum , but didn't get what exactly I want . Is this possible to do in awk ?

I am trying to do some thing like below in ksh script . Upto my knowledge I can pass shell script to awk with "-v " option.
But I need the reverse.

awk `{ variable "X Y Z " defined & modified here } ' infile >  outfile 
$echo X Y Z

Any help appriciated..

Rgds,
prady

has some good knowledge on what you might need

Thank a lot for the link .. I ll go through it..

:slight_smile:

I tried with the following code it seems to working fine.
I mean ./try.sh 4 it gives me 4 what I expect.

try.sh
#!/usr/bin/ksh
nawk -v a=$1 '{
print a
}
' input_file | read a
echo $a

but when I made changes to the above code as follows it gives me the value of $1 to each line of my input_file

nawk -v a=$1 '{
print a
}
' input_file > out_file | read a
echo $a

Please need help ..

Regards,
Prady