|
You're better off calculating the ratio inside the awk script too, besides expr can't do percentages, just integer arithmetic (sic).
In the more general case, make your awk script print whatever you want to smuggle back out to the shell, and run it in backticks, like you're doing with grep -c now to get the count of interactions.
The fact that you can pass in a string representing an awk program doesn't mean you get access to awk's internal state once it's running, any more than you can get access to grep's inner state once it's running. You can pass in input, and get back output.
|