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.
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.
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.