Live data from Hacker News

The Awk Programming Language

awk.dev

141–150 of 159 posts

Re: The Awk Programming Language

#141
post #128
post #124

Earlier quoted context omitted.

[flagged]

It's like when we, Gen-X ers, were repeating bad stuff about COBOL without having seen a single line of it. Then I saw a real COBOL program and... well... it was even worse than what I had imagined :-)

Perl has both oneliners/spaggethi code and games like Pangzero.

Re: The Awk Programming Language

#142
post #137

Earlier quoted context omitted.

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.

Like I said, MicroPython can run even on microcontrollers.

Re: The Awk Programming Language

#143
post #135
post #127

Earlier quoted context omitted.

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.

I think GP means to ask if Excel can read files with ASCII 29,30,31 separators.

Re: The Awk Programming Language

#144
post #85

Earlier quoted context omitted.

> To be really useful as a format it would just need for text editors to: -display something distinct for the field separator Which would be trivial too.

The programming might be straightforward. Trying to persuade the product owners to do it is a different matter.

Pull request?

Re: The Awk Programming Language

#145
post #142

Earlier quoted context omitted.

Small, embedded, busybox systems - per the parent comment.

Like I said, MicroPython can run even on microcontrollers.

I think parent may be more implying “living off the land” situations. Awk is ubiquitous, and part of the POSIX standard. Micro Python, not so much.

I’m a big fan of Forth, but it’s not available everywhere. One has to adapt.

Re: The Awk Programming Language

#146
post #133

Earlier quoted context omitted.

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

Ah good to know, thank you! Meanwhile I found it, it was the awk from Debian 10 that lacked `length(array)`, see the related nvm pr [1].

[1]: https://github.com/nvm-sh/nvm/pull/2917/

Re: The Awk Programming Language

#147
post #86
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…

Ben is not just any old technical reviewer. He wrote a version of AWK in go and has done a ton of other work in the AWK ecosystem.

Thanks! ICYMI: GoAWK [1] - A POSIX-compliant AWK interpreter written in Go, with CSV support.

[1]: https://github.com/benhoyt/goawk

Re: The Awk Programming Language

#148

Awk has always been a language that I loved but I have struggled to use besides quick jobs for parsing text files. I understand it is meant to be use for exactly that, but the fact that is simple, fast and lightweight sometimes makes me want to do something more with it, but when I start trying to do something besides parsing text I find that it starts becoming awkward (pun intented?).

I find it pretty nice for writing simple preprocessors. For example I have one which takes anything between two marker lines and pipes it through a command (one invocation per block). Awk has an amazing pipe operator which lets you do something like this: ... { print $0 | "command" } "command" is executed once, and the pipe is kept open until closed explicitly by close("command"), at which point the next invocation w…

I had no idea about this "keep the pipe open" behaviour. I thought it would spawn the binary on every print statement and thus didn't consider it in the past. But now...

Re: The Awk Programming Language

#150
post #79

Also watch his recent interview on Computerphile: https://www.youtube.com/watch?v=GNyQxXw_oMQ And: Brian Kernighan adds Unicode support to Awk https://news.ycombinator.com/item?id=32534173

Honestly after watching a lot of Kernighan interviews and reading his original book on C he is a very great communicator. I wonder how different the software world would have been without him at Bell Labs. Would Unix and C have become as widely used as quickly?

Kernighan is a national treasure and a world treasure!
Post reply on HN