Live data from Hacker News

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

news.ycombinator.com

31–40 of 51 posts

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

#31
post #27
post #26

Earlier quoted context omitted.

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

[deleted]

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

#32
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 often does a MacOS user who frequently uses awk lack the ability to install gawk?

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

#33
post #26

Earlier quoted context omitted.

> 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 often does a MacOS user who frequently uses awk lack the ability to install gawk?

The claim under discussion in this deep subthread is "it is very rare that you see a system that awk is frequently used on that doesn't have GNU awk installed", so this is irrelevant.

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

#34

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…

I don't see Unix tools as lean and mean, but as brittle and slow. It's never just a "one liner", you end up piping text data through dozens of programs with inconsistent unstructured interfaces.

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.

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

#35

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…

Debian Stable runs GNU Awk. Issuing the command awk --version gives the output:

GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)

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

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

http://www.mawode.com/~waltman/talks/one_liners.yapc11.pdf

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

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

Have yet to learn Perl, but I've frequently not seen it preinstalled on systems, and additionally you sometimes need CPAN to be able to run scripts. awk might not be as powerful, but at least you know it's small, self-contained, and likely to be available in some form on most systems. That's part of its value I think... likely a consequence of not trying to do as much.

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

#38
post #20

Earlier quoted context omitted.

Very cool. Works on iOS with iSH surprisingly. FOUND index.html FOUND favicon.ico

Oh wow. I wouldn't have guessed iSH would have packaged up the extensions I'm using.

Had to `apk add gawk` is all.

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

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

https://catonmat.net/ftp/perl1line.txt ?

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

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

Someone else already asked for perl one-liners in this thread. 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.

Python's default 're' module does indeed lack many features, but there's 'regex' third party module that would be easier to adapt for perl users.

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

Post reply on HN