Need help with gawk

I am trying to use gawk to search a file and put the second value of the string into a string.

gawk -F: '$1~/CXFR/ {print $2}' go.dat

Below is the file 'go.dat'

HOME :confused:
CTMP :/tmp
CUTL :/u/rdiiulio/bin
CWRK :/u/work
CXFR :/u/xfer

====================

So when I type the command manually on the screen, I get the string
'/u/xfer'. However, when I use a shell script to do the same thing, it does not work. Here is the command in the shell script:

gawk -F: '$1~/$chkstr/ {print $2}' go.dat

I set the variable 'chkstr' to '$1' and it does not work. Anybody have a answer to this? Any help will be very much appreciated.

This thread duplicates the discussion going on in the thread: Gawk Question

This thread is closed.