On Thu, Nov 19, 2020 at 09:01:29AM +0800, Cao Xueliang wrote:
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.
the chomp will not delete the \s*$, unless you use rstrip.
Thanks, Yale
Thanks, Xueliang
Thanks, Luan Shengde
- puts "transactions: #{$1}"
- when /95th percentile:\s+(\S+)/
- puts "95th percentile: #{$1}"
- end
end
2.23.0