Hey,
Using one single line of command i am trying to show the CPU usage for 4 processors and then filter it out and write it to a text file. Everything seams ok except that i am not able to switch from having the top command show me all CPU processes seperate opposed to showing me the average of all 4.
I know once i go into top, i can toggle that option by hitting the '1' key. However, i would like to have one command that does this.
I've looked into different configurations files as well but no luck. Any ideas or help would be appreciated. Thanck You
Georges A A
EX:
top -n 1 | cat | head -6 | tail -3 | tr -cs 'a-z',.,'0-9' '\n' | sed '1,8d' | sed '2,8d' | sed '3,9d'> /output.txt
This commmand will get and filter the CPU process and write it to a text file. However, this is only displaying the average of all 4.
But keep in mind, the first iteration, similar to prstat and iostat, is usually junk data and not quite information until you hit the second iteration. But the above will do what you want.
Just as an fyi, it is also helpful in scripting, especially commands that wait for input like format and top and any of the xxstat commands.
i have never seen that error message before. No idea why it is happening. Try echo | format and see if that works. If it does, then there may be some other issue specific to running it with top on your system.
I have never had any problems echoing out top or other similar commands.