The state of the AWK
The state of the AWK
Posted May 20, 2020 10:55 UTC (Wed) by NAR (subscriber, #1313)Parent article: The state of the AWK
AWK reads the input a line at a time. A line is scanned for each pattern in the program, and for each pattern that matches, the associated action is executed.
I think awk started to lose its relevance when data started to be structured differently (XML, JSON, etc.) than by sequence of lines. I don't remember the last time I wrote an awk script, for one-liners perl suffices (with the -e and -n options) - and perl can be used to build bigger programs, so what's the point in keeping up with AWK? Similarly I just realized how odd is writing HTML tags into this form when all other forms I use requires Markdown and I automatically almost started to type it when I realized where I am :-)
Posted May 20, 2020 18:28 UTC (Wed)
by jthill (subscriber, #56558)
[Link]
json and xml are big hammers, far too often people swing them for little jobs.
Posted May 20, 2020 23:57 UTC (Wed)
by wahern (subscriber, #37304)
[Link]
I think AWK is seeing a resurgence precisely because Perl isn't as ubiquitous as it once was. You can't depend on Python being installed, either, and even if you could it still sucks for short, shell-style programming. Which is why as Python has displaced Perl, there's more demand for AWK to fill the remaining gap.
I agree that XML and JSON have altered the landscape, but XML and JSON don't fit streaming paradigms very well. Even when something like jq is available, I usually find the regular shell utilities to be far more convenient, and AFAICT so do most others. It's always been the case that for highly structured data you ended up using more sophisticated programming languages, anyhow. The reason why the Unix shell and shell programming have persisted for so long is precisely because the "one language to rule them all" and "one record format to rule them all" approaches never sufficed nearly enough to displace ad hoc text munging tools. The very nature of the problem domain--gluing together disparate, uncooperative tools and data--contradicts the idea that there could ever be a simple, unified solution.
Posted May 21, 2020 15:57 UTC (Thu)
by smitty_one_each (subscriber, #28989)
[Link]
The state of the AWK
The state of the AWK
The state of the AWK
