4 ms·
The principle advantages of awk: It's everywhere. It's part of the POSIX standard, which means that any POSIX implementation will have it. Including a surpris
by dredmorbius 15y ago
The principle advantages of awk:
It's everywhere. It's part of the POSIX standard, which means that any POSIX implementation will have it. Including a surprising number of embedded systems. Even Perl is slightly less ubiquitous.
It's simple. The entire command set is in a single manpage. This is a two-edged sword: you can quickly scan the entire commandset, but there are a limited number of features.
It's fast. Both in startup and execution. And variants may differ in their speed of processing specific code (gawk and mawk may differ by an order of magnitude, either way, in my experience). There's no initial scramble to read diverse libraries as in Perl or Python. But there's no functionality provided by these diverse libraries.
There's a large set of known idiomatic code to accomplish standard tasks. Can be said for many languages, but it's true.
Awk is very useful for many standard sysadminly tasks. There are other tools which fit the bill, but awk is certainly among the useful tools in your bag.
- rue 15y agoAs a counterpoint, I'd peg its ubiquity as the only advantage for someone who isn't primarily a sysadmin and already knows Python, Ruby or Perl (and surely others). The latter produce much more maintainable code, especially in larger scripts. For those increasingly rare times when higher-level scripting languages aren't an option, one can look up the necessary syntax.