The Awk Programming Language (1988) [pdf] (archive.org)
recommended by 6 users | 2017 | 415 points by dang | command line | original thread |
6 users recommended this thread. What they said:
MaDeuce Jun 15, 2018 | on: Learn just a little Awk (2010) | context

I was first exposed to Awk when I started work at Bell Labs in the late 80s. Until then, I'd been using either Lisp or C exclusively and was really blown away by how simple some things were in Awk. I used it with impunity to munge all sorts of data for input into fault prediction tools I was working on. Speed was never an issue for me, so I never explored the potential improvements offered by 'awkcc'. Although perl was becoming the new hotness at that time, Awk remained my goto tool for many years.

If you are interested in learning Awk, I highly recommend "The AWK Programming Language" by Aho, Kernighan, and Weinberger. It's about the same size as the original "The C Programming Language" and is equally well-written. Previously on HN: https://news.ycombinator.com/item?id=13451454

FelipeCortez Feb 14, 2019 | on: Problem solving with Unix commands | context

The AWK programming language book is excellent!

https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_P...

You can find some discussion about it here: https://news.ycombinator.com/item?id=13451454

brians Apr 16, 2019 | on: GNU Awk 5.0 | context

https://news.ycombinator.com/item?id=13451454

The Aho and Kernighan book is amazing.

hedora Aug 21, 2017 | on: IOCCC Flight Simulator | context

Not games, and the code is in AWK, but this comes to mind (full disclosure - I only read a chapter or two, but the TOC is impressive):

https://news.ycombinator.com/item?id=13451454

davidgould May 12, 2018 | on: Batch editing files with ed | context

Awk really is the tool of choice for this sort of thing:

  $ awk '{print}/baz/ {sub("baz", "elephant"); print}' jvns.txt
  foo:
    - bar
    - baz
    - elephant
    - bananas

Since the script is single quoted you can also lay it out legibly:

  $awk '
  {print}
  /baz/ {
      sub ("baz", "elephant")
      print
  }
  '

which is nice for more complex "one liners". Awk is also standard on all posix environments and in the mawk flavor is extremely fast (relevant if you are processing huge files).

There is superb book, The AWK Programming Language, which teaches a lot about programming in addition to the awk language. Good discussion and link to pdf here: [0]

[0] https://news.ycombinator.com/item?id=13451454

chasil Oct 16, 2023 | on: Chess Written in GNU Sed | context

For awk, start with the book by Kernighan/Aho/Weinberger. The PDF of the first edition is freely available on archive.org, and a second edition has been announced. Chapter 2 of the first edition is only 40 pages, and describes all language features.

https://news.ycombinator.com/item?id=13451454

For sed, the best resource is likely the free "UNIX Bookshelf" from O'Reilly that can be found online; this contains a book specifically focusing on Sed and Awk.

https://freecomputerbooks.com/The-Unix-CD-Bookshelf-Version-...