`countlines(file)` in Base should actually be just as fast as `wc`.

But otherwise, you can do

readall(`wc -l ratings.dat`) to capture all the output of a command (note
that this is `readstring(`wc -l ratings.dat`)` on 0.5)

-Jacob


On Wed, May 18, 2016 at 11:43 AM, Douglas Bates <dmba...@gmail.com> wrote:

> I have forgotten how to capture the output from a shell command.  The
> background is that the `wc` program on Linux (and, I assume, OS X) is an
> incredibly fast way to count the number of lines in a data file, as in
>
> julia> run(`wc -l ratings.dat`)
> 1000209 ratings.dat
>
> I want to capture that string and parse the number.
>

Reply via email to