
19 Nov
2020
19 Nov
'20
9:01 a.m.
On Wed, Nov 18, 2020 at 06:33:55PM +0800, Luan Shengde wrote:
#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/
It is need the "chomp!", there is no "\s*" in the RegEx. Thanks, Xueliang
Thanks, Luan Shengde
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0