3
All, I want to extract values from top for plotting purposes. I'm currently using the following command
top -l 0 -s 1 -pid 12345 -stats rsize | awk 'NR%13==0'
When I run this , I get the expected output. But when I try to redirect the output to a file by running the following:
top -l 0 -s 1 -pid 299 -stats rsize | awk 'NR%13==0' > output.txt
it doesn't work. What should I do to redirect the output to a file?
I'm on a Mac OSX(Lion)
1It seems that batch mode (-b) is not implemented on OS X. You could set larger value for -l (say "-l 10"), but you won't be able to see the output until after the script is done, e.g. "tail -f output.txt" won't work for monitoring. – lupincho – 2012-02-19T07:45:04.923
@lupincho: the only problem is awk buffering. – tuergeist – 2012-02-19T21:32:04.153