Show HN: An eBook with hundreds of GNU Awk one-liners
539 pointsHi,
I recently published my ebook on GNU awk one-liners [1]. It starts from the basics of awk syntax and then discusses one-liner examples. There's a chapter on regular expressions as well. The github repo has the details on how to get the PDF version, all the example files and code snippets used in the book, sample chapters as well the markdown source used to generate the PDF.
I made all my ebooks [2] free last month amidst the pandemic fears. These include GNU grep & ripgrep, GNU sed and three books on regular expressions (Python, Ruby, JavaScript).
I'd appreciate your feedback and hope the books are useful. Happy learning :)
[1] https://github.com/learnbyexample/learn_gnuawk
[2] https://learnbyexample.github.io/books/
Comments (48) 14 threads
Show all comments
Showing thread 1 of 14
I'm not sure about your point saying "only very minor enhancements". When I posted about my book on reddit, I got this comment [1] noting feature differences.
[1] https://www.reddit.com/r/commandline/comments/fqkc6r/just_pu...
https://pubs.opengroup.org/onlinepubs/009695399/utilities/aw...
It’s a calculator; type in something like 2 + 2 and it will give you 4. Since standard AWK has advanced math functions like log, it’s a full blown scientific calculator.Here’s my AWK (OK, shell + AWK) one liner:
The only tricky part is that you hit Ctrl + C (not Ctrl + D) to exit it.
[1] http://www.skeeve.com/awk-sys-prog.html
(Not saying gawk isn’t significantly better than awk for some tasks.)
These were two separate claims, and are very different.
It is very rare that you see a system that awk is frequently used on that doesn't have GNU awk installed.
Wait, what? Ubuntu server and macOS both have awk preinstalled (which is true for any POSIX) and gawk not preinstalled. Those are what I (and many other developers) spend 95% of my time on. And I do use awk frequently.
Edit: Okay, /usr/bin/awk is actually gawk on Ubuntu, so I was wrong about that. Still, macOS isn't very rare.
Continue this thread — 5 replies
I don't understand the reverence for these tools. I think it's a bunch of junk that somehow can't get replaced because it's not quite bad enough and it's "already installed" everywhere.
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)