Add new comment
Want to support HowtoForge? Become a subscriber!
|
Hello, I would like to make one remark. When extracting the information out of the file top.txt, I would not rely on the fixed number for the column (35-39). If something happens like the number for ni(ce) or sy(stem) are taking more room than they do now, the information of your choice may end up in columns 38-43. I think it's better to take advantage of the patterns present in the file: after every column there is a "," : cat top.txt | grep ^Cpu | cut -d "," -f 4 | cut -d "%" -f 1 should do the job. Note futher that I use the ^ sign before Cpu. That's selecting only the lines which start with "Cpu". By omitting this, a line with Cpu somewhere in it is also selected. Kind regards, Stef Bon
Reply |



Recent comments
16 hours 2 min ago
20 hours 51 min ago
1 day 1 hour ago
1 day 4 hours ago
1 day 4 hours ago
1 day 4 hours ago
1 day 8 hours ago
1 day 9 hours ago
1 day 11 hours ago
1 day 18 hours ago