From: "Jon R." Date: 2012-07-05T20:58:44+09:00 Subject: Re: Newbie needs help with parsing a file Ryan this worked beautifully. Thank you. However, I can't seem to get why all of the % signs are in the line puts "%s %.1f%%" % [vol, pct * 100] and what does %s mean? Ryan Davis wrote in post #1067285: > On Jul 3, 2012, at 16:54 , Aleksey V Zapparov wrote: > >>> second number is used space. If the comparison is 90% or more, then >> next arr if "vol" == str >> next arr if 2 > arr.push(str).count >> >> dept, home = arr >> puts "#{dept} VS #{home}" >> >> [] >> end > > There are many tools in the String toolbox. #scan is often a much more > powerful tool than #split: > > str = "/vol/dept115345K111455K/vol/home1156668K507768K" > > str.scan(%r%(/[a-z]+/[a-z]+)(\d+)K(\d+)K%).each do |(vol, quota, > actual)| > pct = actual.to_f / quota.to_f > > next unless pct > 0.9 > > puts "%s %.1f%%" % [vol, pct * 100] > end -- Posted via http://www.ruby-forum.com/.