Azhdarchid

awk is the standard general-purpose programming language

awk is the standard general-purpose programming language

On , Bruno wrote:

When I SSH to a VPS I just spun up, there's no guarantee whatever godforsaken LTS version of Ubuntu it's running has Node.js or Ruby on it, let alone some fancy-schmancy version manager. Python? Don't make me laugh—nobody in the last 20 years has been able to successfully install Python. So I use the language that doesn't waste my VALUABLE time: awk, which is the standard general-purpose programming language.

Some of you may be skeptical. Some of you may be asking "what standard". I'll tell you what standard: the POSIX standard. Before Perl was a mere twinkle in anyone's eye, awk was here. You may say: "isn't awk an utility for extracting data from text files with tab-separated values." To which I say: 99% of programming is extracting data from files and putting it into other files in various ways. awk already knows that's what you want to do, so it skips all the bullshit like "opening a file" or "creating a stream" or, God forbid, "allocating memory".

Now you may say, "surely awk is inadequate for some types of programming. I mean, every number in awk is a float." To which I'll say: the same is true of JavaScript and this has not stopped anybody. I think at this juncture in the history of computing we should be ready to admit that integers are just a sort of safety blanket for programmers. If you never give a number a fractional component, floating-point math doesn't happen and all is right in the world. I think that's true. I don't really understand floating-point math at all.

Now you may say, "well, I mean, awk has no GUI toolkit." Wrong. awk has the exact same GUI toolkit you were going to use anyway.

# table.awk
# Consumes a text file and displays a GUI table of its contents.

BEGIN { print "<table>" }
{ printf "<tr><td>%s</td><td>%s</td><td>%s</td></tr>", $1, $2, $3 }
END { print "</table>" }

How do you use this GUI toolkit? It's simple: cat table.txt | awk table.awk | lynx (lynx is the standard web browser). "But what if I need interactivity," I hear you whine. Easily managed; awk is in fact a superset of Javascript.

END { print "<script>"
      print "(function(){"
      print "document.querySelector(\"#button\").addEventListener(\"click\","
      print "function(){ console.log(\"button clicked\") })"
      print "})()"
      print "</script>" }

Please understand. awk is the standard general-purpose programming language. The sooner you accept this fact the sooner we can move on.