3 ms·
No, it really isn't. Languages like Awk and especially tools (you could say "language" because it's strictly true but, come on) like sed have built in safeguar
by Blackthorn 12y ago
No, it really isn't.
Languages like Awk and especially tools (you could say "language" because it's strictly true but, come on) like sed have built in safeguards against writing code that stretches for more than a certain number of lines. That safeguard is that it's a really awful experience to actually do that. As a result these scripts tend to be short and to the point.
Perl does not have this safeguard.
- comex 12y agoIt 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.