From: Marcin Kulisz Date: 2007-05-03T04:17:32+09:00 Subject: Re: file & split ok, guys I solved this very tough problem :-) and this is a solution for someone who will need it for any reason, but I have another question how can I do this code more Ruby (I mean more solid and nice in ruby style) because it seems for me very vulgar sum=0.0 count=0 impr_count=0 if ARGV[0]!=nil then File.open(ARGV[0]) do |file| while line=file.gets if line=~(/^([0-9]+)K/&&/%/) count+=1 end impr_count+=1 tab=line.split c8=tab[7].to_f sum+=c8 end eval=impr_count-count puts puts "Av. download speed: #{sum/count} KB/s" print "I've read #{count} proper & " eval>1 ? (puts "#{eval} improper lines") : (puts "#{eval} improper line") puts end else puts print "Corupted or missing file or file path!!!\n\tPlease repeat command with correct data\n" puts end -- Posted via http://www.ruby-forum.com/.