Hi,
Is there a way to evaluate an equation contained in a string within an AWK script?
For example:
A = "(5*2)-1" (this equation is read from a file and varies line by line)
In this example, I can't see any way to get an answer of 9 unless I do:
cmd = "awk 'BEGIN{print "A"}'"
cmd | getline A
The above method works fine but it's rather slow when dealing with large files!
Does anybody know of a better way of achieving the same result within the main AWK script?
Any help and advice appreciated.
Steve