3 ms·
Awks super power, and the reason I mostly use it, is it's free read loop, free field splitting, and the pattern/condition matching model. As a LANGUAGE, it's "
by whartung 3y ago
Awks super power, and the reason I mostly use it, is it's free read loop, free field splitting, and the pattern/condition matching model.
As a LANGUAGE, it's "eh". It just happens to be "good enough".
You can, of course, do all of that with Perl. But then I have to write all that boiler plate I get with awk for free. And the gains in Perls language aren't enough, for me, to dump awk. And I don't use it for "scripting", I use it for data processing, tearing up files for mostly one off tasks. So I don't miss Perls depth. If I want depth, I'll go somewhere else.
- e63f67dd-065b 3y ago> free read loop perl -n > free field splitting perl -a ... $F[1/2/3/etc] > pattern/condition matching model Not quite sure what you mean, but `perl -lane 'print if /abc/'` is might be what you're looking for The boilerplate can be mostly eliminated with the magic incantation of `perl -lane`. The trick that makes all this work is that perl defines a whole bunch of pre-defined variables and populates them with things that might be helpful (see $_, @F, etc).