Hacker News new | ask | show | jobs
by segmondy 2429 days ago
I look forward to reading this

I own and have read his following books and they were all superb!

   The Go Programming Language
   The Practice of Programming
   The C Programming Language
   The AWK Programming Language
2 comments

also 'the Unix programming environment'
And The Elements of Programming Style.
Just out of curiosity, why awk? I've only ever used it for simple text splitting and didn't really know people did more with it. Is it a tool worth learning?
To really appreciate the need for awk, imagine writing one-liners and scripts in the late 80s where Perl or Python weren't present. The associative arrays in awk were a game changer. Of course, today there is no need to use awk for multi-line, complex scripts because Python or Perl does the job better (and both languages are more scalable). However, awk is still quite useful for one-liners. But for those developers who never use the one-liner paradigm of pipelines on the command line, this is something they don't realize they're missing.

Brian Kernighan mentions in the book that awk provides "the most bang for the programming buck of any language--one can learn much of it in 5 or 10 minutes, and typical programs are only a few lines long" [p. 116, UNIX: A History and Memoir]. Also keep in mind Larry Wall's (inventor of Perl) famous quote/signature line: "I still say awk '{print $1}' a lot."

More background on awk from Brian Kernighan in a 2015 talk on language design: https://youtu.be/Sg4U4r_AgJU?t=19m45s

Personally, I don't think that it's worth learning if you don't already know it, but the awk book is really an enjoyable read, not particularly wrong, and will show what you can do with the language so you can make a more informed decision whether to learn it.

In a way, awk, like sed, cut(1), paste(1), comm(1) is closer to the original Unix design philosophy of pipeline composition of simple, single function tools. cut, paste, and comm are simple, single function. sed is programmable, and awk even more so, but they're still optimized for being used in pipelines. Perl still has lots of options designed for pipeline usage (-p, -n, -a, -0, -F), but was always capable of doing general purpose programming, and python is primarily general purpose programming.

Personally, I've never learned sed, cut, paste, or comm; the only traditional text processing tools I use are sort & uniq. I know awk, but the one time I wanted to use it in the last 5 years in an official script, I was shouted down by confused youngsters. I use perl for one liners, and python for any nontrivial scripting.

It's a tool. If you ever need to slice and dice text, AWK is great. Sure, perl is great too, but I can never remember perl and stopped writing perl. I rarely use AWK by itself, it's usually with a mixture of other unix tools.

I once wrote code with curl, awk, sed, jq, xargs and in less than 30 lines implemented something that would have taken about 200 lines of go code. I did it too in less than an hour when I was told it would take a day. It was urgent and I needed the result fast.

There are different kind of hammers, different kind of nails and screws. Know your tools, use them when it's called for. You can use a wrench as a hammer, doesn't make it a great one.

Awk is great for data pipelines, not just oneliners.

For a long while I maintained a program that took the compiler output (intermediate form) from one toolchain, and converted it to another (intermediate form).

Why awk? It was faster, and more readable, than any of the alternatives, whilst being much much shorter.

Besides its obvious utility and generality (many tasks in computer science can be effectively solved by "simple text splitting" when the data is a few GB, and your data is often a few GB), it is worth learning awk just because the awk book is a masterpiece.
It's a question you have to answer yourself. I struggle to see how awk would fit into my work flow, personally, and it's not feasible to learn every cool tool. And you'd have to use it somewhat frequently or you start forgetting the syntax, unless you make Anki cards
awk is interesting because it was an early programming language (not just text processing) which made a number of convenient data structures available to people who could not program C.
https://disqus.com/home/discussion/tomwoods/ep_1186_lightnin...

Youtube-dl and awk to grep out of a YouTube channel.

If I were doing it again I would use youtube-dl -o to just print the base64, instead of "manually" renaming it to that with ls>awk:mv>sh.