#!/usr/bin/ruby -w cpuinfo = `sar | tail -n 2 | head -n 1 | awk '{print $2 " " $3 " " $4}'`.chomp.split(/\s/) user, system, idle = cpuinfo if system == '0100' system = 0 idle = 100 end print "#{user}\n#{system}\n#{idle}\n"