From: Chad Perrin Date: 2007-08-24T02:48:42+09:00 Subject: Re: # of lines in a file On Tue, Aug 21, 2007 at 07:34:26AM +0900, Jano Svitok wrote: > On 8/21/07, blufur wrote: > > is there built-in method to determine the number of lines in a file? > > > > i tried file.readlines.length but it is very slow (dealing with files > > > 1 million lines) > > if on unix: > `wc -l #{filename}` or similar (I don't remember the exact syntax for wc) Your use of syntax is correct, there. The -l option tells wc to only report the number of lines. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] John Kenneth Galbraith: "If all else fails, immortality can always be assured through spectacular error."