Live data from Hacker News

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

news.ycombinator.com

21–30 of 51 posts

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

#22
post #19

I always like when classic lean-and-mean Unix tools get attention, as opposed to big language ecosystems. Speaking of which, is there a particular reason why only gawk is covered? gawk has only very minor enhancements to POSIX awk, and gawk isn't even the default in many place. For example, Debian uses, or used to use, mawk as default, while the BSDs and Mac OS have nawk. I think the point of awk is that it's portabl…

gawk is pretty much everywhere now that awk sees substantial use, and presents rather great enhancements over POSIX awk[1]. I usually don't think that GNU tools make much sense to focus on, but gawk is something that's, generally-speaking, worth doing so. Especially given that it runs on almost everywhere under the sun. [1] http://www.skeeve.com/awk-sys-prog.html

“It runs everywhere” (gawk) is very different from “it’s installed out of box everywhere” (awk). The latter can be used in provisioning scripts, shell script libraries/modules, etc. where the former usually can’t.

(Not saying gawk isn’t significantly better than awk for some tasks.)

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

#23
post #17
post #8

Is there any equivalents of perl one-liners?

no starch press sells a Perl One Liners book. https://nostarch.com/perloneliners

The book is based on this article series: https://catonmat.net/perl-one-liners-explained-part-one

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

#25
post #22
post #19

Earlier quoted context omitted.

gawk is pretty much everywhere now that awk sees substantial use, and presents rather great enhancements over POSIX awk[1]. I usually don't think that GNU tools make much sense to focus on, but gawk is something that's, generally-speaking, worth doing so. Especially given that it runs on almost everywhere under the sun. [1] http://www.skeeve.com/awk-sys-prog.html

“It runs everywhere” (gawk) is very different from “it’s installed out of box everywhere” (awk). The latter can be used in provisioning scripts, shell script libraries/modules, etc. where the former usually can’t. (Not saying gawk isn’t significantly better than awk for some tasks.)

My claims were that GNU awk is everywhere that awk sees substantial use, and that it runs everywhere.

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.

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

#26
post #25
post #22

Earlier quoted context omitted.

“It runs everywhere” (gawk) is very different from “it’s installed out of box everywhere” (awk). The latter can be used in provisioning scripts, shell script libraries/modules, etc. where the former usually can’t. (Not saying gawk isn’t significantly better than awk for some tasks.)

My claims were that GNU awk is everywhere that awk sees substantial use, and that it runs everywhere. 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.

> 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.

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

#27
post #26
post #25

Earlier quoted context omitted.

My claims were that GNU awk is everywhere that awk sees substantial use, and that it runs everywhere. 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.

> 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…

How many OS X users do you think are actively using awk in any of its variants? What percentage of total awk usage is on OS X, do you think? OS X may not be rare, but it seems highly unlikely that many OS X systems see frequent usage of awk.

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

#28
I want a Perl one. I never saw the need to do AWK because I knew Perl fairly well.

In saying that the youngsters should learn some of these old school tools. Python is a nice language but the regexes are crap acompared to Perl. I always need to look up the documentation. Perls are built in, clean and concise.

(caturing, groups) = string =~ /regex/

I remember that having not touched Perl in a while. I miss it.

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

#30
post #28

I want a Perl one. I never saw the need to do AWK because I knew Perl fairly well. In saying that the youngsters should learn some of these old school tools. Python is a nice language but the regexes are crap acompared to Perl. I always need to look up the documentation. Perls are built in, clean and concise. (caturing, groups) = string =~ /regex/ I remember that having not touched Perl in a while. I miss it.

There is a perl oneliners book from nostarch press
Post reply on HN