うまくいかない
うまくいかない
def textread() pattern=Regexp.new(ARGV[0]) file1=ARGV[1] file2=ARGV[2] file_in=open(file1) file_out=open(file2,"w") count=1 while text=file_in.gets() if count%2!=0 file_out.puts(text) if pattern=~text snow=file_in.gets() prabbit=snow.to_i/10 print(text,":",prabbit) end else rabbit=text.to_i/10 file_out.puts(rabbit) end count=count+1 end file_in.close file_out.close end textread()