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
18 hours 3 min ago
19 hours 31 min ago
23 hours 6 min ago
1 day 1 hour ago
1 day 4 hours ago
1 day 5 hours ago
1 day 5 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 8 hours ago