rsh within awk is not workin

cat input.sh | awk '
{
cur1=tolower($1)

cur2=tolower($2)

rsh $cur1 report | grep $cur2

} '

hi,
Have a look at the above code, the input.txt file contains two words in each line with space as delimiter, the first word is computer name and the 2nd word is file name in that computer,

i tried to do rsh within awk command, i get error as

also this is a shell script and using awk command..

./madh1.sh: line 1: !#/bin/bash: No such file or directory
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error
awk: cmd. line:13: rsh $cur1 report | grep tree | grep $cur2
awk: cmd. line:13: ^ syntax error

printing the string $cur1 and $cur2 works perfectly, but rsh is not working..

also if i do rsh outside of awk it works perfectly..

can you please help me..

thanks in advance,

regards,
geeko.

In an awk script, you must use awk commands; awk is not a shell.

To call a shell command from within an awk script, use the system() function.

(And you don't need to use cat; use the filename as an argument to awk.)

you have to send the shell variables into the awk script..