Sujet : Re: lisp scripts
De : nospam (at) *nospam* lisse.NA (Eberhard W Lisse)
Groupes : comp.unix.shellDate : 14. Feb 2025, 22:51:57
Autres entêtes
Message-ID : <m19s7uFbvn8U2@mid.individual.net>
References : 1 2 3
User-Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Betterbird/128.6.0
On 10/02/2025 02:00, Lawrence D'Oliveiro wrote:
On Sun, 09 Feb 2025 11:07:43 -0500, Dan Espen wrote:
I once spent a week converting a LOT of sed/awk to Perl. I turned
a complicated mess into something any programmer could readily
understand. (And actually worked.)
I have pointed out several times that Perl does everything awk can
do, at least as concisely, and a lot more besides. Which is why I
never bothered to learn awk.
Some people get annoyed every time I say that.
Now I'd use Python.
[...]
Python, Shmython. It's like whether vi or emacs is the better editor
(of course Sublime Text is the better one :-)-O)
Awk is very good for short one liners on reasonably short input files,
because Perl takes longer to load.
Perl is very good for large input files, a more complete programming
language with gazillions of modules and around for ages.
Python is probably as good as Perl or better and has gazillions of
libraries. However this need for virtual environments and that scripts
stop working after a Python upgrade, make things complicated and has
turned me off from learning it, which I wanted to do as I have
retired.
Don't forget LUA :-)-O
If you are young and want to learn a (new) programming language don't
start with Perl, start with Python.
If you have worked with Perl for ages, carry on I doubt there is
anything in Python that you can't do in Perl.
If there is a need to learn shell then learn shell (bash, zsh or
whatever).
I recently had to come up with a script that takes a DNS zone file, and
constructs a really complicated CSV of 79 columns delimited with ';'
and "pivoting" name servers from 'long' to 'wide' (but without
aggregation) with the IP addresses concatenated to the names of the
glue records, some of which didn't even have IP addresses.
Perl script works quite will for smaller zones, but does not scale well.
Bash script with QSV pipelines and DuckDB (for the 'pivoting') is
extremely fast. So fast that I didn't try Perl with DuckDB.
The Bash script is as readable as the Perl script because I tend to
comment so much that I later can figure out what I did and why,
myself :-)-O
That's 11 cents from a retired Gynecologist :-)-O
el