Reputation: 3633
I am trying to run the following line in an awk script and I am getting an error. I think the error is because the filename has spaces in it. How do I call the file without changing the path name (i.e. rename the file/path)? The code is contain within a BEGIN{} block.
INSTALLATION_LOCATION_GAWK = "L:/CPU_Analysis/Sanity/CPUAnalysisApp/cpu_analysis_application/"
DATA_SUMMARY_LOCATION_GAWK = "C:/Program Files/CPU Analysis/data/data_summary.csv"
....
command = ("gawk -v version=" dataArray[1] " -v date=" dataArray[2] " -v platform=" dataArray[3] " -f ") (INSTALLATION_LOCATION_GAWK "generateSanity_Scripts/removeData.awk ") DATA_SUMMARY_LOCATION_GAWK
system(command)
UPDATE: I also ran into the issue that you cannot copy/save/edit files in C:\Program Files due to windows restrictions. I solved this problem by moving my project to C:\My Programs.
Upvotes: 0
Views: 173
Reputation: 247042
I think it will be a case of providing quotes in the command string:
command = "gawk"
command = command " -v version=\"" dataArray[1] "\""
command = command " -v date=\"" dataArray[2] "\""
command = command " -v platform=\"" dataArray[3] "\""
command = command " -f \"" INSTALLATION_LOCATION_GAWK "generateSanity_Scripts/removeData.awk\""
command = command " \"" DATA_SUMMARY_LOCATION_GAWK "\""
Upvotes: 1