2 ms·
It depends on what you want to do. Even for simple text processing in one-liners, there are quite a few common tasks that are difficult in awk. A big one for
by comex 12y ago
It depends on what you want to do. Even for simple text processing in one-liners, there are quite a few common tasks that are difficult in awk. A big one for me is capture groups in regular expressions:
perl -ne 'print $1 if /foo="(.*?)"/'
awk '/foo=".*"/ { ??? }'
You can do it with gawk, but it's ugly:
gawk 'match($0, /foo="(.*?)"/, a) { print a[1] }'
Another is manipulating hexadecimal numbers, which is also a gawk extension.