> 
> **Possible Duplicate:**  
> 
> [Use a script parameter in awk](https://unix.stackexchange.com/questions/50044/use-a-script-parameter-in-awk) 
> 
> 
> 

I have a script, in which a script snippet is

```
x=3
awk '$2=$x{print $1}' infile

```

the external variable is x,

but it prompts an error in awk

so in this situation,how to make awk run successfully?

thanks!