5 ms·
Interesting take, but as someone who still works regularly with the shell, I'd say there is still a place for small core utils connected together with pipes/tex
by nmfisher 4y ago
Interesting take, but as someone who still works regularly with the shell, I'd say there is still a place for small core utils connected together with pipes/textual streams.
If we're talking parsing and chopping up text files, I can usually whip up something with awk/jq/cut/whatever in far less time than writing an equivalent Python script. There's a threshold where you prefer to switch to the scripting language for maintainability/testing, but the shell won't be going anywhere any time soon.
- peelle 4y agoI agree with this threshold idea, and I would argue that Perl and probably Ruby also have a lower threshold for switching than Python. Nothing against Python.
- collyw 4y agoHaving moved from Perl to Python, there isn't really anything difficult in switching. I looked at Ruby too, which felt like a tidied up version of Perl, especially regarding
- hedora 4y agoMost awk/cut/whatever commands can be done with perl -ne in about 2x the keystrokes, but you don't need to learn the other tools. In Python, the multiplier is much higher, and I could never get the oneliner stuff to work.
- biomcgary 4y agoI use cut, grep, uniq, etc. a lot for processing largish files (multiple GB), but also use perl oneliners generously. Never took to awk for some reason. These days I write Go for anything larger than a oneliner, but I've added a lot of smallish Go CLI commands to use in pipes, too.
- cutler 4y agoI don't understand why Python is touted as some kind of replacement for Perl when there are many things Perl does better and faster. Python isn't even optimised for one-liners so how can it be compared with Perl?
- collyw 4y agoI moved from Perl to Python around 2011, mainly for Django. Perl is a more expressive, "cleverer" language. But I noticed when I moved to Python that I write better code. Too often in Perl I would try something clever and terse, then two days later it would bite me in the bum and cause more problems than it solved. I would still pull out Perl for some quick bash replacement type script, regular expressions are so much nicer in Perl, but for larger scale long term projects where maintenance is important, I would go for Python.