I have a small piece of c code which should run an awk command on my linux machine. However for the life of me it will not exec. The awk works if I directly run it in the terminal.
My current failed command
system("awk '{ printf \"%d \n\", $12 }' results.dat | sort -n");
It fails with
awk: { printf "%d
awk: ^ unterminated string
How else do you escape the double quotes so that the command will run? Also why does this fail, but when I replace the system call with a printf it will print?