I have a c program named calculate which sorts out the correct data
Data input (initial file.txt):
abcd!1023!92
ckdw!3251!io
efgh!9873!xk
Data returned:
abcd!1023!92
efgh!9873!xk
My shell script contains:
./calculate | awk -F '!' '{sum += $2} END{print sum}' "$1"
When I run the script ./check file.txt it ignores the values returned from the calculate function and instead calculates from the input file.
How do I fix this so that the "awk" function works from the data returned from the ./test function?