SLUG Mailing List Archives
Re: [SLUG] Tuesday afternoon shell command optimisation party!
- To: Andrew Bennetts <andrew-slug@xxxxxxxxxxxx>
- Subject: Re: [SLUG] Tuesday afternoon shell command optimisation party!
- From: Rick Welykochy <rick@xxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 08:56:03 +1100
- Cc: slug@xxxxxxxxxxx
- User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:184.108.40.206) Gecko/20070802 SeaMonkey/1.1.4
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
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