Writing to User-Specified File

Hi, I'm writing an awk script to remove redundant XML data.

I plan on running the script with the following line:

cat xmlFile.xml | awk -f scriptFile

I want the user to be able to choose the filename that the slimmed down XML code is written to. All of the writing to the slimmed-file is done in my END block. Is there a couple of lines that I can put in my BEGIN block which allows the user to enter a path to write a file to?

Thanks for your time, and your help

The best way is to use a shell script. Something like this:

printf "Enter the path: "
read path
awk -v path=$path '
END {
  print path
}' xmlFile.xml
BEGIN{
  printf("Enter pathname : ")
  getline path < "-"
}