|P is for Practical|
Re: what's this loo code? (*slurp*)by tye (Sage)
|on Feb 04, 2003 at 17:58 UTC||Need Help??|
I waited and two explanations have already appeared as I hoped and expected...
But I wanted to mention my first impression when I saw that code in jmcnamara's node: "Oh, that takes way too much memory and will fail for files that don't fit within your available swap space".
The number of possible Perl one-liners that print a line count and don't suffer from requiring way too much memory for large files is quite huge. I'll shoot for a very straight-forward one:
perl -le '1 while <>; print $.' file