@mboelen@DopeGhoti Nice work! Always trying to have something I can use to teach newcomers, which in my case are too much spark oriented these days and forget tiny little awk can handle quite a lot 😅
I tend to follow the logic of awk better than the one of sed (not being a vi enthusiast), but it is good to see when one might be better than the other:
for like more than 30 years, i have kinda skirted writing serious #ShellScripts, getting good with #awk and #sed , and getting really good with #LaTeX because it usually meant a TON of digging through old documentation and piecing things together. Recently, i just started asking #chatgpt things like:
How do I flip through a directory of a bazillion zip files, uncompress each one, put the contents on my NAS, and then move those zip files somewhere else for safekeeping?
Another interesting AWK feature(?) that is likely little known is that there can be any number of BEGIN and END patterns and they can be anywhere in the AWK program. Their statements are concatenated into one action at run-time.
This makes me wonder, has anybody a) ever seen this used in production code and b) why? #awk#unix#linux
v1.0 then:
“Perl is kind of designed to make #awk and #sed semi-obsolete […] The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).” https://github.com/Perl/perl5/releases/tag/perl-1.0
@mjgardner@Perl I remember first encountering Perl as Perl3, just before Perl4 and the Camel book. I remember looking at the crazy sigils and deciding, "this is it, the first new language I don't bother to learn."
6 months later, I had learned.
30+ years later, the majority of my working life continues to be spent manipulating those sigils. @rrays and $calars and h%shes FTW!
AWK was designed to harmoniously integrate with the Shell and follow the Unix philosophy. Perl and to some degree Ruby offer that as well. The ease with which a single line AWK script can be integrated in a Shell pipeline is what keeps it alive. Python very much does not offer that, Python scripts are standalone programs.
What other languages are out there that can do something as simple as 'print $2' in a Shell pipeline? jq comes to mind. #linux#unix#shell#awk#perl#ruby#python
through all of my sysadmin experience i've been using #sed and avoiding #awk… for some reason. scratch that: for no good reason.
awk is to sed what python is to brainfuck.
the awk programs are a lot more easy to compose and modify, flexible and readable. and there's a brilliant book by the authors — now awailable for a free read from archive.org!
in retrospect, i can't see any tasks that i should have done with sed instead of #bash / awk.
So... I pre-ordered the new second edition of The AWK Programming Language and it arrived today. The packaging demonstrated Amazon's keen awareness of talking a good game and failing to follow through. #Amazon#AWK#Linux#Books
Today's @hrbrmstr drop mentions one my favorite CLI languages: #awk, back in the mid to late 1990s it was my workhorse for processing data from molecular dynamics simulations, protein structures and other crazy stuff like that 🙂
#Tcl (also known as Tool Command Language; pronounced as either "tickle" or as an initialism) is a high-level, general-purpose, interpreted, dynamic programming language.
It was made in 1988 by John Ousterhout and it was inspired mainly by #C, #Lisp, #Shell, #Awk and has served as one of the inspirations of #PowerShell and #Python due to its simplicity and elegance.
Tcl was designed and "born out of frustration" because John Ousterhout wanted a better language for #EDA (and especially the #VLSI tool Magic). Tcl to this day has a strong foothold in EDA. Tcl was made to be easily embeddable in #C for rapid prototyping, scripted applications, GUIs, and testing. You can find Tcl implementations for almost every operating system and due to it being lightweight it can be also seen in embedded development.