4 ms·
The problem with awk today is that it has very few features that would make it superior to Perl,Ruby or Python. The only instance where awk has utility for me
by glofish 7y ago
The problem with awk today is that it has very few features that would make it superior to Perl,Ruby or Python.
The only instance where awk has utility for me is when the program is short enough to be explicitly specified at the command line, for example:
$3 > 10 { print $6 - $5 }
for that it is awesome, you don't have to look inside another program to figure exactly what is happening, it is explicit etc. it is also super fast, much-much faster than splitting with a typical scripting language
for anything more complicated than that, it offers very few benefits (I'd be hard pressed to name any) and significant limitations.
Thus IMO the problem with awk is that it does too little and offers to little room to grow.
- Spivak 7y agoBut you’re missing out on so much good stuff when you do this. Awk might not replace Python once you start needing external dependencies but awk can absolutely replace bash in a lot of situations.
- glofish 7y agoI will say that I have yet to see a program that, when rewritten in awk rather than python would look worth to learn awk instead of python. But it could be that I was just never shown one.
- pizza234 7y agoBash and Awk are not the same class of languages, so they can't be compared to/replace each other. Bash is a glue language, while Awk a scripting one, so it rather makes sense to compare Awk with Python/Ruby/similar.
- gpanders 7y agoI think awk is better than any of the alternatives if the problem you're solving matches a pattern-expression paradigm and, as others have said, you have no external dependencies. Granted, this is quite a constraint and perhaps there aren't many problems that fit this model, but when you do encounter one of those problems it's good to have the right tool for the job.