3 ms·
I've made this point in the past, but I find it absolutely hilarious to see the number of kids these days who are rediscovering awk. Awk was dead; like dead-de
by ajross 5y ago
I've made this point in the past, but I find it absolutely hilarious to see the number of kids these days who are rediscovering awk. Awk was dead; like dead-dead, totally useless legacy silliness, for decades. And the reason was that literally everything you could write in awk could be more easily and more powerfully expressed in perl. In a world where every system comes with perl and every admin knows perl, there's no room for awk.
But then... perl kinda died back. It's no longer default in many distros. Most new unix kids aren't learning it. Perl is the old weirdness.
And... in a world without perl, awk looks pretty cool I guess. But folks: perl is still there.
- tyingq 5y agoI love Perl, but for one liners, awk is often easier to remember than something like Perl's autosplit. Awk is often faster too, for large data files, mawk especially.
- massysett 5y agoAwk has an enormous advantage over Perl: the Awk manual is short, and you can conceivably learn Awk just by reading the man page. If I go back years later and read an Awk program, I’m more likely to understand it. Using Perl for many tasks would be like using Matlab to add up a column of numbers. You can, but there’s also something to be said for just using a pocket calculator.
- jdougan 5y agoHeck, back in the mid-80s we wrote a stripped down awk as part of a 2nd year CS course. Can't do that with Perl.
- throwaway5486nv 5y agoSay i want to print the Nth column of programs output how easy it is compared to awk?
- ajross 5y agoHeh, sure: perl -ne 'print((split())[1])' While it's true that "{print $2}" is a little shorter, it's also quite limited. The perl syntax extends naturally to different delimeters (the first argument to split is a regex) or actions (maybe you don't want to print it and want to do some tiny string processing). Essentially, you picked the One Single Task at which awk is best. And... it's only barely better, and only for the specific variant of the problem for which awk was designed. Again, this argument was had and settled. No one in their right mind would have been caught writing an awk script in 1997. That doesn't mean awk is bad (it's software from the mid-70's!), it means it was superceded. And it's important for people interested in those sorts of problems to understand why it got replaced.