benhoyt / goawk

A POSIX-compliant AWK interpreter written in Go, with CSV support

Home Page:https://benhoyt.com/writings/goawk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for network?

s3rj1k opened this issue · comments

Is there a plan to add networking support in-spirit of this https://www.gnu.org/software/gawk/manual/html_node/TCP_002fIP-Networking.html ?

No, sorry, I don't really want to go down that route (to me it doesn't seem in the unix-y spirit of "do one thing well"). However, you're welcome to use system() and pipes with network-based tools like curl, or if you're using GoAWK as a Go library, you could add your own custom Go functions which do network operations: https://pkg.go.dev/github.com/benhoyt/goawk@v1.26.0/interp#Config.Funcs

@benhoyt I actually wanted to ask next about the ability to add some kind of modules.

So if I understand correctly, I can extend GoAWK to support JSON with Config.Funcs? (when using as lib)

Also thank you for the great project.

You could make some JSON parsing and serialisation functions with Config.Funcs, yes. However, you couldn't add first-class JSON support that would convert input lines to fields -- that's discussed as a separate feature in #152.