I'm trying to reduce columns of top funcion and save it into a file but I don't know how do it using system() function with quotes. I'm doing it like this:
system("top -b n1 | grep \"^ \" | awk '{ printf(\"%s %s %s %s %s %s %s\n\", $1, $2, $8, $3, $9, $10, $12); }' >> file
I'm pretty sure the problem is with the quotes, can someone help me?