OTOH, awk can't actually delete a column(*) and doesn't have built-in join() or splice() functions - all of which are pretty damn useful when manipulating input records consisting of multiple fields.
You can write join and splice functions for awk, but then you lose the quickness advantage.
(*) you can kind of fake it with "$0=$0;$1=$1" trickery, but that has side-effects that are sometimes undesirable.
BTW, I've got nothing against awk. I use it all the time. I probably use awk more than perl these days, even though I learnt perl long before I learnt awk. My rule of thumb for awk is: if it's really simple, use awk. Otherwise use perl. Which is almost identical to my rule of thumb for when to use sh or bash vs perl.
"A" in "Awk" is for "Aho" (Score:5, Interesting)
Thanks, Mr. Aho. Awk has saved my bacon many, many times. I still use it several times a week.
Re: (Score:3)
Out of curiosity, why awk and not perl? More convenient one-lining? Or...etc.
Re: (Score:3)
A lot of times the -F flag and then "print $F[xxx]" is more hassle than just "{print $1}".
I do use Perl for a lot of things but awk and sed one-liners are frequently just a little quicker to dash off when digging through some output.
Re:"A" in "Awk" is for "Aho" (Score:2)
OTOH, awk can't actually delete a column(*) and doesn't have built-in join() or splice() functions - all of which are pretty damn useful when manipulating input records consisting of multiple fields.
You can write join and splice functions for awk, but then you lose the quickness advantage.
(*) you can kind of fake it with "$0=$0;$1=$1" trickery, but that has side-effects that are sometimes undesirable.
BTW, I've got nothing against awk. I use it all the time. I probably use awk more than perl these days, even though I learnt perl long before I learnt awk. My rule of thumb for awk is: if it's really simple, use awk. Otherwise use perl. Which is almost identical to my rule of thumb for when to use sh or bash vs perl.