From: Robert Klemme Date: 2007-04-28T21:50:11+09:00 Subject: Re: Output A File w/ Line Numbers? On 28.04.2007 09:06, Robert Dober wrote: > On 4/28/07, Robert Dober wrote: > >> > love, >> > John Joyce >> > >> > >> ARGF.readlines.each_with_index{ >> | line, idx | >> puts "%3d %s" % [ idx.succ, line ] >> } >> HTH >> Robert > > But Robert's solution is nicer, I did not know about ARGF.lineno, and > have overlooked his solution, sorry! :-) Thank you! Btw, you can also do ARGF.each_with_index so you do not have to read the whole file into mem before printing it. Kind regards robert