Passing a variable into an awk script

Hello all,
I'm trying to run a script of this format -

for i in $(cat <file>); do
grep $i <file1>|awk '{print $i, $1, $2}'

It's not working - does anyone know how this can be done?

Khoom

#!/bin/ksh
for i in $(< file ); do
   nawk -v myI="${i}" '$0 ~ myI { print myI, $1, $2 }'
done

ksh: nawk: not found

<sigh>

try with plain 'awk'

I have it now - thanks to vgersh99 for the inspiration

for i in $(cat <file>); do
grep $i <file1>|awk -v string=$i '{print string, $1, $2}'

  1. why do you need a 'cat'?
  2. why do you need a 'grep'?