First you need to assign the variables with the -v option:
The option -v followed by var=value is an assignment to be done before (the awk program).
Example of use:
This example define a bash file, that look for any entry “address” into the squid’s access file.
$ cat > search
#!/bin/bash
awk -v address=”$1″ ‘$3 == address && $4 ~ /200/’ /var/log/squid/access.log
$ chmod +x search; sudo ./search 192.168.0.2