Live data from Hacker News

Show HN: An eBook with hundreds of GNU Awk one-liners

news.ycombinator.com

1–10 of 51 posts

Show HN: An eBook with hundreds of GNU Awk one-liners

#1
Hi,

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/

Re: Show HN: An eBook with hundreds of GNU Awk one-liners

#2
Very nice. I had cobbled up a "one liner" (sort of) gawk webserver on here a couple a months ago: https://news.ycombinator.com/item?id=22085459

I tried making it scalable, but unfortunately, the server sockets in gawk don't set SO_REUSEPORT. So, I can't fork usable children. It does work if you use LD_PRELOAD tricks, or edit the gawk binary to change SO_REUSEADDR to SO_REUSEPORT, but both are pretty hacky.

If gawk would separate the listen() and accept() calls out, you could do a lot more with their server socket code.

Re: Show HN: An eBook with hundreds of GNU Awk one-liners

#3
post #2

Very nice. I had cobbled up a "one liner" (sort of) gawk webserver on here a couple a months ago: https://news.ycombinator.com/item?id=22085459 I tried making it scalable, but unfortunately, the server sockets in gawk don't set SO_REUSEPORT. So, I can't fork usable children. It does work if you use LD_PRELOAD tricks, or edit the gawk binary to change SO_REUSEADDR to SO_REUSEPORT, but both are pretty hacky. If gawk wo…

impressive, if I use -o option to get a pretty printed version, it comes to 68 lines

Re: Show HN: An eBook with hundreds of GNU Awk one-liners

#5
post #2

Very nice. I had cobbled up a "one liner" (sort of) gawk webserver on here a couple a months ago: https://news.ycombinator.com/item?id=22085459 I tried making it scalable, but unfortunately, the server sockets in gawk don't set SO_REUSEPORT. So, I can't fork usable children. It does work if you use LD_PRELOAD tricks, or edit the gawk binary to change SO_REUSEADDR to SO_REUSEPORT, but both are pretty hacky. If gawk wo…

Very cool. Works on iOS with iSH surprisingly.

    FOUND index.html
    FOUND favicon.ico

Re: Show HN: An eBook with hundreds of GNU Awk one-liners

#9
post #8

Is there any equivalents of perl one-liners?

Perhaps something like this:

https://gist.github.com/joyrexus/7328094

The thing about cookbooks is that you rarely find something that matches what you need in the moment - you really need to learn and use these tools regularly and then you'll be prepared without documentation.

Re: Show HN: An eBook with hundreds of GNU Awk one-liners

#10
post #8

Is there any equivalents of perl one-liners?

I started with command line text processing repo [1] about three years back. That has a chapter on grep/sed/awk/perl/ruby one-liners along with many other tools. I may convert perl one-liners to a book as well later.

[1] https://github.com/learnbyexample/Command-line-text-processi...

Post reply on HN