Awk is awesome! Glad that they are looking to modernize the book. It wasn't really necessary, all the code examples in the original edition of the book still run just fine, although some are somewhat dated, like printing ASCII bar graphs. They also had examples of writing VMs, parsers and interpreters in the book, which run on modern implementations.[0] The language has some quirks. To declare temporary variables, it…
What would you suggest as an alternative to printing ASCII bar graphs? I do that all the time. Takes 20 seconds and often makes distributions, modalities, and patterns over time obvious right away.
The Awk Programming Language
31–40 of 159 posts
Re: The Awk Programming Language
#32Earlier quoted context omitted.
This is exactly why I moved from AWK to Perl for these quick jobs a couple of years ago. If you stick to an AWK-like subset, Perl is also simple, fast and lightweight. If you want to grow your scripts (and you have a lot of discipline) Perl – in contrast to AWK – gives you enough noose to hang^W^W^W^Wthe tools you need.
Perl? Wow. Is that better than bash, python or even nodejs? Why write in Perl over these? Serious question, was propaghandized to hate Perl.
Re: The Awk Programming Language
#33Currently looking @ alternatives (not that I dislike AWK, far from it): Tokay: https://github.com/tokay-lang/tokay frawk: https://github.com/ezrosent/frawk
Re: The Awk Programming Language
#34Re: The Awk Programming Language
#35Currently looking @ alternatives (not that I dislike AWK, far from it): Tokay: https://github.com/tokay-lang/tokay frawk: https://github.com/ezrosent/frawk
What do you think of them? Tokay in particular looks very polished.
Re: The Awk Programming Language
#36Earlier quoted context omitted.
This is exactly why I moved from AWK to Perl for these quick jobs a couple of years ago. If you stick to an AWK-like subset, Perl is also simple, fast and lightweight. If you want to grow your scripts (and you have a lot of discipline) Perl – in contrast to AWK – gives you enough noose to hang^W^W^W^Wthe tools you need.
Perl? Wow. Is that better than bash, python or even nodejs? Why write in Perl over these? Serious question, was propaghandized to hate Perl.
It depends on scale.
If you have some quick parsing to do, then awk will get you started quickly, but as you expand your experimentation on what you want to extract/manipulate, it may not be easy to add onto the awk beginnings of your "one liner".
But if you start with awk-like† syntax but invoking it with Perl, then if you find you have to expand, Perl has more elbow room.
The intention is not to 'go big', which those other languages may be better at, but to more easily 'start small'.
† IIRC, Larry Wall wanted a utility that had awk/(s)ed-like syntax for text manipulation, just 'with more'.
Re: The Awk Programming Language
#37Earlier quoted context omitted.
Perl? Wow. Is that better than bash, python or even nodejs? Why write in Perl over these? Serious question, was propaghandized to hate Perl.
Absolutely. It is comparable to python in some ways, but makes it much easier to write quick one-liners using regexes and data manipulation, and to scale those up to real programs. It fills the gap between bash scripts using awk, grep and sed, and C/java/C#. Compared to bash scripting, perl is a real programming language. The documentation and library ecosystem are excellent, backwards compatibility is legendary, yet…
0: https://github.com/bentxt/microperl-standalone
1: Original article from 2000 by the author Simon Cozens: https://www.foo.be/docs/tpj/issues/vol5_3/tpj0503-0003.html
Re: The Awk Programming Language
#38Also watch his recent interview on Computerphile: https://www.youtube.com/watch?v=GNyQxXw_oMQ And: Brian Kernighan adds Unicode support to Awk https://news.ycombinator.com/item?id=32534173
Re: The Awk Programming Language
#39I picked up this little book from my University library once, and it was a fantastic read.
Re: The Awk Programming Language
#40Awk has always been a language that I loved but I have struggled to use besides quick jobs for parsing text files. I understand it is meant to be use for exactly that, but the fact that is simple, fast and lightweight sometimes makes me want to do something more with it, but when I start trying to do something besides parsing text I find that it starts becoming awkward (pun intented?).
> but the fact that is simple, fast and lightweight I see awk as a DSL to be honest. Yes, it can be used as a general purpose language, but that quickly becomes, as you say, awkward :D Like many DSLs, it is simple, fast and lightweight as long as it is used for it's intended purpose . Once you start using it for something else, these advantages evaporate pretty quickly, because then you have to essentially work aroun…