I need to insert an awk command in a shell script like this:
#/bin/bash
temp_folder="FOO"
awk 'BEGIN {
RS="END:VCARD"
FS="\n"
}
{
command = "echo -n FOO/$(pwgen 20 1).vcf"
command | getline filename
close(command)
print $0 "END:VCARD" > filename
close(filename)
}' "${file}"
PROBLEM: In the BEGIN section, I want to replace FOO by the temp_folder variable (like $temp_folder, ${temp_folder} or something else). I have tried different solution but none worked to make the value of the variable recognized. (Problem with quotes?).
How to write the variable in the section ?