From: Ferdous ara Date: 2012-09-04T06:56:36+09:00 Subject: Re: need help to get output Regis d'Aubarede wrote in post #1074491: > member,slot="","" > File.readlines(ARGV[0]).each do |linecrlf| > line = linecrlf.chomp > case line > when /^member/ then member=line > when /^Slot/ then slot=line > when /Memory utilization/ > puts "%10s %10s %s" % [member,slot,line.gsub(/\s+percent/,"%")] > end > end Hi thanks I put those output in a router file so i edited like this #!/usr/bin/ruby member,slot="","" File.readlines("router").each do |linecrlf| line = linecrlf.chomp case line when /^member/ then member=line when /^Slot/ then slot=line when /Memory utilization/ puts "%10s %10s %s" % [member,slot,line.gsub(/\b+percent/,"%")] end end but it shows ruby router_check.rb router_check.rb:10: invalid regular expression; there's no previous pattern, to which '+' would define cardinality at 3: /\b+percent/ -- Posted via http://www.ruby-forum.com/.