4 ms·
Is perl as widespread as sed and awk in linux distros and other OSes? If I want to make a script that works across the board I feel like the latter are much mor
by mattrighetti 3y ago
Is perl as widespread as sed and awk in linux distros and other OSes? If I want to make a script that works across the board I feel like the latter are much more adopted, is that correct?
- asicsp 3y agoPerl would be better suited as a portable solution, since you only have to take care of feature differences between Perl versions. For grep/sed/awk, you also have to worry about implementation differences (GNU/BSD, gawk/mawk/nawk and so on).
- mbivert 3y agoPerl is essentially a standard on UNIX. In particular, there's a Perl interpreter backed with OpenBSD's base installation[0]. If you avoid recent features (you wouldn't be missing too much), then your Perl code should run with little trouble. However, in my experience, when I start to feel the need to use something more sophisticated than sh/sed/awk, I tend to shy away from Perl in favor of more "robust" languages. Go often is a good-enough substitute (static typing, single-file deployment, trivial cross-compilation); YMMV. [0]: https://marc.info/?l=openbsd-misc&m=159041121804486&w=2 https://marc.info/?l=openbsd-misc&m=159041121804486&w=2