[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can Lua replace awk?
- From: Steve Litt <slitt@...>
- Date: Mon, 7 Mar 2011 08:33:15 -0500
On Monday 07 March 2011 04:46:48 steve donovan wrote:
> The point is that specialized tools _can_ easily be written in Lua for
> quick command-line jobs. But good tools for the right niche, etc.
There's a certain class of problem for which awk is wonderful. Awk is perfect
for parsing a whole file, that can easily be parsed in one pass, but require
considerable break logic.
First of all, awk is the one language that doesn't require you to write a read
loop, but instead implies it. Second, by reordering conditions you can
implement some pretty sophisticated break logic without a lot of complication.
The time to switch from awk to Lua is when the awk solution starts getting so
complex that you're tempted to pipe results between multiple awk programs.
Recession Relief Package