Add new comment
Do you like HowtoForge? Please consider supporting us by becoming 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
4 hours 11 min ago
9 hours 59 min ago
11 hours 50 min ago
13 hours 35 min ago
17 hours 25 min ago
23 hours 10 min ago
23 hours 21 min ago
1 day 3 hours ago
1 day 9 hours ago
1 day 14 hours ago