Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Tuesday afternoon shell command optimisation party!

Andrew Bennetts wrote:

If you want to avoid reading the whole file into memory:

python -Sc "import sys; print sum(l.count(',') for l in sys.stdin)" < input.txt

Yes. That's much better. Slurping the input into memory doesn't
scale well.

And they said TIMTOWTDI applied only to perl.


Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being made.
    -- Otto von Bismarck