title: How to capture CPU Idle time from Top
body: <p>I am trying to capture the CPU idle time from TOP.
  The following code captures Load Average
  I am trying to manipulate the following code so that it capture's CPU idle time. </p>
  
  <p>Any ideas welcome.</p>
  
  <pre><code>top -bn1 | grep load | awk '{printf "CPU load %: %.2f\n", $(NF-2)}' 
  The Above Code Outputs: CPU load %: 0.44
  </code></pre>
  
  <p>I want to change the code so that it outputs CPU idle time
      CPU Id %: 92.9%</p>
  
  <p>Example Top output:</p>
  
  <pre><code>top - 10:35:25 up 1 day, 16:06,  5 users,  load average: 0.24, 0.16, 0.15
  Tasks: 210 total,   2 running, 198 sleeping,  10 stopped,   0 zombie
  %Cpu(s):  2.2 us,  0.2 sy,  4.7 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.1 st
  KiB Mem:  16433064 total,  1353396 used, 15079668 free,   180944 buffers
  KiB Swap:        0 total,        0 used,        0 free.   700468 cached Mem
  
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  24293 ubuntu    30  10   32828   2576   1608 S  19.3  0.0   0:25.30 fiberlamp
   2173 ubuntu    20   0   51200  16496   4952 S   9.3  0.1 263:34.18 Xvnc4
  12648 ubuntu    20   0   23668   1732   1180 R   0.3  0.0   0:04.25 top.....
  ........
  </code></pre>