News for hackers. Stuff that matters.
Re:Awk by Example by segmondy on Friday June 28, 2019 @08:26PM (#20309984)
Just grab the awk book, the awk programming language. https://ia802309.us.archive.org/25/items/pdfy-MgN0H1joIoDVoI...

Yesterday, I wrote production level code using awk. It was either write the code in go which I figured would take all day. But I had really about an hour or so. 40 lines of shell script mixture of about 20 lines of awk and bash/sed/grep/tail/xargs/cut/cat/curl got the job done.

AWK is very freaking powerful if you learn to parse data with it.

Re:Awk by Example by news_hacker on Friday June 28, 2019 @10:44PM (#20310476)
Probably a good book, but it serves a way different purpose than this article which is more of a gateway drug for newbies like myself who have never worked with awk before and don't quite understand the value-add.

I really enjoyed this article, because now that I have a sampling of the class of problems that awk can help me with, I am more likely to use it. And it only took 10 minutes to get this overview. My brain is already buzzing with ideas on how I can use this with gron[1] that was mentioned a few days ago on HN.

We all need a compelling reason for a tool before investing the time for whatever Bible may exist, so "just grab" the Bible first instead isn't the most helpful advice :) But I do appreciate you flagging it!

[1] https://github.com/tomnomnom/gron

---

P.S. For those who liked the writing style of this tutorial, you may enjoy these other ones on the IBM website by the same author Daniel Robbins: https://www.ibm.com/developerworks/views/linux/libraryview.j...

Re:Awk by Example by asicsp on Friday June 28, 2019 @11:50PM (#20310720)
wonder if Arnold Robbins (gawk maintainer) and Daniel Robbins are related (wiki tells me Daniel is founder of Gentoo Linux)
Re:Awk by Example by asicsp on Friday June 28, 2019 @09:42PM (#20310280)
Might I ask why this old version (I haven't read it) instead of the manual/book for GNU awk? [1] It does a good job of mentioning differences between other implementations and GNU awk extensions are marked

[1] https://www.gnu.org/software/gawk/manual/

Re:Awk by Example by bch on Friday June 28, 2019 @09:55PM (#20310325)
That old version is written by the ‘A’[0], ‘W’[1], and ‘K’[2] that are the eponymous inventors of awk, and the book is at least occasionally cited as basically a masterpiece.[3]

[0] https://en.wikipedia.org/wiki/Alfred_Aho

[1] https://en.wikipedia.org/wiki/Peter_J%2E_Weinberger

[2] https://en.wikipedia.org/wiki/Brian_Kernighan

[3] https://en.wikipedia.org/wiki/The_AWK_Programming_Language

Re:Awk by Example by asicsp on Friday June 28, 2019 @11:46PM (#20310706)
I've also seen this book mentioned elsewhere but never took the effort of reading it. Hopefully I'll go through it sometime soon - it may be ~30 years old, but the core concepts is likely to work in gawk even now.

Also, the gawk book is written by Arnold Robbins who is one of current maintainers of the tool and as per [1] gawk was started by David Trueman and Arnold.

[1] https://www.gnu.org/software/gawk/manual/html_node/Foreword3...

Re:Awk by Example by enriquto on Saturday June 29, 2019 @07:20AM (#20311950)
This book is not "an old version". This book is K&R-class. Moreover, the "K" is from the same person in both cases.