Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irb(main):001:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s/).map do |i|
- irb(main):002:1* i.match(/([0-9]*(\.|\,)[0-9]*)/).captures[0].to_f
- irb(main):003:1> end
- => [0.2, 1.8, 11.5, 86.4, 0.0, 0.0, 0.1, 0.0]
- irb(main):004:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s*/).map do |i|
- irb(main):005:1* i.match(/([0-9]*\.[0-9]*)/).captures[0].to_f
- irb(main):006:1> end
- => [0.1, 1.8, 11.8, 85.6, 0.8, 0.0, 0.1, 0.0]
- irb(main):007:0> `cat /etc/issue`
- => "Ubuntu 16.04 LTS \\n \\l\n\n"
Add Comment
Please, Sign In to add comment