3 ms·
This is very cool for simplifying interactive use :) but I'd like to caution people away from immortalizing it in their scripts. sed and awk are both standardiz
by Sir_Cmpwn 8y ago
This is very cool for simplifying interactive use :) but I'd like to caution people away from immortalizing it in their scripts. sed and awk are both standardized by POSIX and can be found on pretty much any system, and trivially ported to new systems. Porting Python, on the other hand, is comparitavely a mammoth proposition, and often impossible on some platforms. For this reason, I'm generally allergic to "new $x replaces $y!" for any $y which is governed by portable standards.
- bihla 8y agoI agree. For anything longer term, I'd recommend finding the right bsed command and then using -t flag to get the Perl translation. Perl is installed by default on common operating systems.
- Sir_Cmpwn 8y ago>Perl is installed by default on common operating systems. Aye, but what about the uncommon ones? For your consideration, I'd like to share Perl's configure script: https://github.com/Perl/perl5/blob/blead/Configure https://github.com/Perl/perl5/blob/blead/Configure It's my favorite configure script of all time, but I would hate to be the guy who has to extend it with a new platform :) And I have!
- username223 8y agoThis is something I love about Perl: in an age of many subtly incompatible operating systems, Perl said "F it, we'll do what it takes to compile and run your program everywhere." People don't appreciate this now, when everything is Linux, Mac, or Windows, but back when you regularly had to deal with various BSDs, HPUX, AIX, Mac OS 9, and even the occasional VAX, Perl was a godsend.
- snazz 8y agoAnd even though Perl grew up on and for Unix, there are a couple of distributions that work good on Windows, too, even though I think Perl feels more at home on Unix, where it came from.
- hpcjoe 8y ago$_ =~ s/was a/is a/g; There, I fixed it for you. Seriously, I see so many ways of re-inventing these wheels, written in the fad languages/systems d'jour. Perl works very well, for a large subset of tasks that are common. The same code that ran 25+ years ago (in perl4) on my Sun and Irix machines, runs today on my laptops in linux, MacOSX. I remember building Perl atop the Cray J90 running Unicos in grad school, as I had built run automation software in it (not a queuing system, but code to encapsulate some of my runs and return the relevant data). I had developed that code on my OS2 based desktop with Perl. Perl is a go-to language. It gets stuff done. Without pain.
- acqq 8y ago> For anything longer term, I'd recommend finding the right bsed command and then using -t flag to get the Perl translation. That could be a part of the readme!
- yumraj 8y agoThat's a good point. I think something like this would work extremely well in manual workflows and personally I can see myself using it from within my text editor, such as vscode. Scripts, as you said, might be better off with sed/awk. Edit: Or, as OP said in a sister comment, using -t and using the Perl command in scripts makes a lot of sense.