From: John Johnson Date: 2003-04-27T10:11:06+09:00 Subject: Re: File reading and line continuation with '\' This should do it: File.open(in_filename, "r") { |inFile| inFile.each_line ("\\") { |line| # whatever } } Regards, JJ On Sat, 2003-04-26 at 20:39, Jim Freeze wrote: > Hi: > > Is there an simple way to get ruby to read lines in a file > ending with a backslash, '\', as a single line? > > > cat a > one\ > two > irb(main):001:0> a=File.read("a") > => "one\\\ntwo\n" > irb(main):002:0> b=File.readlines("a") > => ["one\\\n", "two\n"] > > I would like instead: > > f=File.readlines("a") > ["onetwo\n"] > > Thanks > > -- > Jim Freeze > ---------- > Positive, adj.: > Mistaken at the top of one's voice. > -- Ambrose Bierce, "The Devil's Dictionary" >