On Fri, Sep 30, 2022 at 02:22:34AM +0200, Joerg Sonnenberger wrote: > On Thu, Sep 29, 2022 at 08:39:16PM +1000, Jonathan Gray wrote: > > wc counts items in files. Finding the longest item indeed sounds > > like a task better suited to awk. > > Finding outliers, means and counting are all parts of the same basic > class of operations. A good implementation of all of them requires > constant space and a fixed time per input character. An implementation > in awk will generally not have that property.
Why ? is awk really that bad at managing memory ? Anyway, we have perl in base, and it will definitely fit the bill. Heck, I can do it in shell with constant space and a fixed time per input character. Real world computing 101: complexity is not all that matters, the constant in O(1) is often what will actually kill you. Real world computing 102: any utility left unfettered for long enough will grow a lisp interpreter and go into a mud-fight with emacs.