You can't get much better than unix command line tools for this sort of thing. Any reason you can't use `wc` directly? I'd do this using run(`wc`...) from within Julia.
Regards - Avik On Wednesday, 19 August 2015 11:10:40 UTC+1, Daniel Carrera wrote: > > Hello, > > I need to count the number of lines in a large number of UNIX text files, > most of which are fairly large. I need help coming up with an efficient > implementation of a line-count program. A naive implementation like > length(readlines("foo.txt")) is very slow (notice how this loads the whole > file into memory just to count newlines). I imagine that it should be > possible to count the number of newline characters quickly, like what the > "wc" command does, but I can't figure out how. Does anyone have any ideas? > > Thanks for the help. > > Daniel. >