Add new comment

Submitted by stefbon (registered user) on Fri, 2008-03-21 11:15.

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

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.