search and replace using awk with variables

Hi,

I have been trying to use awk with variables that needs to search for a pattern and replace it with another pattern, the patterns are supplied in a variable. I have tried several different ways without success and hope that someone can help me. Here are the details

echo $UPC
07007457809

echo $ITEM
57801

echo $line1
530,185836,20081202,RM0220599,20081206,07007457809,CT,4

and when I try the following command to search for $UPC in $line1 and replace it with $ITEM, using awk I dont get desired results.

echo $line1 | awk -v srch="$UPC" repl="$ITEM" '{ sub(srch,repl,$0); print $0 }'
awk: 0602-533 Cannot find or open file { sub(srch,repl,$0); print $0 }.
 The source line number is 1.

Please help correct syntax.
Thx
Jerardfjay

echo $line1 | awk -v srch="$UPC" -v repl="$ITEM" '{ sub(srch,repl,$0); print $0 }'

vgersh99,

Thanks, knew it had to be a simple mistake. Thanks for pointing it out though.

Regards
Jerardjfjay