Live data from Hacker News

The Awk Programming Language

awk.dev

131–140 of 159 posts

Re: The Awk Programming Language

#131

Ok, dumb question: Is the link supposed to link to the actual book (i.e., is the book free and/or open source) or is this just a page of miscellaneous interesting links about the book (which we can pay for, later, when it's published). I was expecting the book, but the page itself says "This page is a placeholder for material related to the second edition of The AWK Programming Language." It's fine if this is a place…

I think the page description is quite clear: it contains material related to the book. Not the book itself. So I would guess all downloadable code and perhaps supplementory material.

Re: The Awk Programming Language

#133
post #25

I was privileged to be one of the technical reviewers for this book. There's a fair bit of the original content (which is still great), but Kernighan's done a great job with some good restructuring and some significant updates, too. The early chapters are very hands-on, with something of a focus on "exploratory data processing", particularly with CSV files. Big data with AWK, you could say. Gawk and awk will soon hav…

Awk is really great, for those knowing nvm [1], I used awk to make `nvm ls-remote` run more than 10 times faster [2] by replacing the related shell script with around 60 lines of awk script [3], and I was quite happy with the improvement.

It's not really a one-liner, neither something big, but one can take that as an example regarding that awk is really not just for one-liners.

Meanwhile having `--csv` support is really nice. I'd also like to see things like a builtin `length` function to be standard.

[1]: https://github.com/nvm-sh/nvm/ [2]: https://github.com/nvm-sh/nvm/pull/2827/ [3]: https://github.com/nvm-sh/nvm/blob/9a769630d7/nvm.sh#L1703-L...

Re: The Awk Programming Language

#134
post #133
post #25

I was privileged to be one of the technical reviewers for this book. There's a fair bit of the original content (which is still great), but Kernighan's done a great job with some good restructuring and some significant updates, too. The early chapters are very hands-on, with something of a focus on "exploratory data processing", particularly with CSV files. Big data with AWK, you could say. Gawk and awk will soon hav…

Awk is really great, for those knowing nvm [1], I used awk to make `nvm ls-remote` run more than 10 times faster [2] by replacing the related shell script with around 60 lines of awk script [3], and I was quite happy with the improvement. It's not really a one-liner, neither something big, but one can take that as an example regarding that awk is really not just for one-liners. Meanwhile having `--csv` support is rea…

But length() is standard POSIX, no? Even length(array) has been approved by POSIX [1] but not yet included in the spec (they're very slow to update the spec for some reason). Both forms have been supported in onetrueawk, Gawk, mawk, and Busybox awk for a long time.

[1] https://www.austingroupbugs.net/view.php?id=1566

Re: The Awk Programming Language

#135
post #127
post #125

Earlier quoted context omitted.

Visidata works with arbitrary separators. I just tried with a CSV separated with ␟ (ASCII unit separator) and it worked just fine.

Excel too?

lolive, VisiData has some Excel support. However, don't expect VisiData to be a full blown editor for Excel files. It can provide a view of the data in an Excel spreadsheet.

Re: The Awk Programming Language

#136
Awk was great at its time, but when you need at write more than 5 lines of awk code please consider using python since

1. It is a lot faster than awk/perl/grep/sed combos

2. Way a lot readable and maintainable

3. More powerful than awk with it's string functionalities

4. Same availability as awk in OSs since last decade

Re: The Awk Programming Language

#137
post #76

Earlier quoted context omitted.

Is there a particular benefit in writing a VM in AWK, placed in a big BEGIN block? Very similar code can be written in Perl or Python. Isn't the strength of AWK in its line-matching capability, being able to pattern-match a line against a block of code?

AWK runs everywhere . Perl and Python do not. Busybox has their own independent AWK implementation. https://busybox.net/ https://frippery.org/busybox/ Also see the first edition of the AWK manual online here: https://archive.org/details/pdfy-MgN0H1joIoDVoIC7

I'm sorry, where does Awk run but Perl and Python don't?

If we're counting minimalist implementations, there's micropython that even runs on microcontrollers that cost a less than 2 dollars.

Re: The Awk Programming Language

#138
post #136

Awk was great at its time, but when you need at write more than 5 lines of awk code please consider using python since 1. It is a lot faster than awk/perl/grep/sed combos 2. Way a lot readable and maintainable 3. More powerful than awk with it's string functionalities 4. Same availability as awk in OSs since last decade

[flagged]

Re: The Awk Programming Language

#139
post #98

I know lots of people like awk, but I pretend it doesn't exist. Why? Here's my comment on this from 6 years ago[0], >I used awk until I learned Python (long ago). For me, awk was yet another example of the "worse is better" approach to things so common in unix. For example, if you make a syntax error, you might get a message like "glob: exec error," rather than an informative message. "Worse is better" is probably a…

I will bet you $1000 that time spent learning Awk will lead to better results much faster than time spent polluting your privileged user directories with Python's excuse for "dependency management"

I agree entirely!

For many python users, it’s the only language they know. Often, they see programming in python, as part of their “identity” - so they’re overly invested in it, to the detriment of other wonderful languages, like awk.

I used to code perl myself, back in the day - but I came to appreciate the simplicity of awk, and now it’s one of my favourites. I no longer code perl, as a consequence, as I believe awk to be far more elegant! I wouldn’t have done so, if I was overly invested in being a “perl programmer”.

Re: The Awk Programming Language

#140
post #137
post #76

Earlier quoted context omitted.

AWK runs everywhere . Perl and Python do not. Busybox has their own independent AWK implementation. https://busybox.net/ https://frippery.org/busybox/ Also see the first edition of the AWK manual online here: https://archive.org/details/pdfy-MgN0H1joIoDVoIC7

I'm sorry, where does Awk run but Perl and Python don't? If we're counting minimalist implementations, there's micropython that even runs on microcontrollers that cost a less than 2 dollars.

Small, embedded, busybox systems - per the parent comment.
Post reply on HN