Help with awk and accessing variable values within the syntax
Hello,
I'm writing a bash script, and I am having trouble with this line:
awk '{print "url = \"http://www.example.com/directory/$type/"$1"\""}' input.file > output.file
Within the URL being printed, I wish the value of the variable "$type" to be printed. However, the quotation marks associated with the awk command do not allow the value of the variable to be called (syntax highlighting doesn't recognize $type as a variable, but rather as a literal part of the URL). Thus, the URL that ends up being printed literally has "$type" printed as a part of it. I would like to know how to change this behavior so that the actual value of the variable $type is printed within the URL instead. Any help would be appreciated.
Last edited by meridionaljet; 07-09-2011 at 04:34 AM.
|