3 ms·
If you are comparing Awk vs Perl for scripts, I'd prefer Perl (or Python). This post is about short one-liners for ad hoc use cases. I prefer sed/awk over Perl
by asicsp 3y ago
If you are comparing Awk vs Perl for scripts, I'd prefer Perl (or Python).
This post is about short one-liners for ad hoc use cases. I prefer sed/awk over Perl for such cases. Though, if you already know Perl, you could continue using it instead of having to learn more tools.
- SOLAR_FIELDS 3y agoDo all systems still come with Perl baked in these days? If so I could see reaching for that over awk/sed. If I have to install a runtime I may as well just reach for Python
- pphysch 3y agoA bunch of the default git extensions are written with Perl, so you will find some version of it available on most modern Linux systems
- thesuperbigfrog 3y ago>> Do all systems still come with Perl baked in these days? If you use Git for Windows (https://gitforwindows.org/ https://gitforwindows.org/), it includes Perl.
- btschaegg 3y ago…and gawk :)
- thesuperbigfrog 3y agoYes. Frequently any tool set that has gawk will also include sed, perl, cut, head, tail, less, vi / vim, etc. It is nice that Git for Windows includes bash and all these tools.
- em500 3y agoWhat are "all systems"? Most mainstream Debian or Fedora based systems install Perl by default (but not necessarily in specialized settings such as embedded/boot/rescue systems). Alpine linux does not include it in standard images. FreeBSD (and probably Net/OpenBSD) don't install Perl by default. The current macOS still includes it, but Apple has notified that it will be removed at some point. Windows does not include Perl or awk by default. Sed and Awk are part of POSIX, and maybe more importantly also part of Busybox. They're almost always available when Perl is available, while the reverse is not true.