Problem with using using quote in awk script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

i have the output of a csh script piped to an awk script. In the awk script i was trying to assign a variable with the output of a command, the problem is when i use the quote ' or ` it gave me syntax error and when i use " it printed out the command instead of its expected output

  1. Relevant commands, code, scripts, algorithms:
#!/bin/csh

./a_script | awk 'BEGIN { FS="." } { num = "cat $argv[1] | grep $0 | wc -l"; printf "%s %s %s\n", $1, $0, num }'
  1. The attempts at a solution (include all code and scripts):

the above

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

University of Southampton, Bob Damper, comp1005

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

'cat argv' does not work inside awk. awk is not a shell language. Neither does grep or wc -l.

What does the output from a_script look like, and what do you want to do with it?

Hi ymc1g11,

One way to solve the problem:

awk 'BEGIN { FS="." } { "cat $argv[1] | grep $0 | wc -l" | getline num; printf "%s %s %s\n", $1, $0, num }'

the output of a_script looks like the following:

and my $argv[1] is actually an access log file, by using grep and the above line as argument, i want to find out how many times had the file been viewed. Yet some of the output of a_script might not been accessed b4, any help?