3 ms·
Is there any reason to prefer it over `perl -pie` ? I found out that at the base level, they are pretty comparable; and at advanced level, CPAN (or perl- packag
by theamk 6y ago
Is there any reason to prefer it over `perl -pie` ? I found out that at the base level, they are pretty comparable; and at advanced level, CPAN (or perl- packages in distro's repo) have saved me more than once.
(Some embedded systems often do not have perl, but if they are that limited, they might have a very stripped down version of awk too)
- freedomben 6y agoIf you already know perl -pie well, then it may not be worth it to switch to Awk unless maybe you do a lot of embedded development. Awk is part of posix so is pre-installed and available nearly everywhere, even on many embedded devices. Busybox for example includes an implementation of Awl. Even my super cheap home router had an awk interpreter on it. Perl is also decreasingly commonly installed. On the latest Fedora for example I had to install it explicitly. Awk is still installed by default.
- duskwuff 6y agoNot really. For many years, perl even shipped with a tool ("a2p" [1]) which would automatically translate awk syntax to perl -- there's very little distance between the two, syntactically speaking. [1]: now available as https://metacpan.org/pod/App::a2p https://metacpan.org/pod/App::a2p
- downerending 6y agoOne likely unpopular answer is that learning to use perl-pie well is more likely to lead one to create large perl programs, vs awk. Many of us feel those programs would be better written in Python.