I need to use awk command inside a Tcl script. I have a file like the following. Let's call it giri.txt.
1 what
2 Why
3 When
4 who
I wrote the following code, thinking it will print like this:
what did
why did
when did
who did
set a did
exec cat giri.txt | awk {{ print $2 " " $a }}
But it prints like this:
what what
why why
when when
who who
Can anyone explain why it's printing like this? Can any one suggest a way to use a Tcl variable inside awk?