DEV Community

Discussion on: AWK an old-school tool today

Collapse
barakplasma profile image
Michael Salaverry • Edited on

great article!

also check out

GitHub logo ezrosent / frawk

an efficient awk-like language

frawk

frawk is a small programming language for writing short programs processing textual data. To a first approximation, it is an implementation of the AWK language; many common Awk programs produce equivalent output when passed to frawk. You might be interested in frawk if you want your scripts to handle escaped CSV/TSV like standard Awk fields, or if you want your scripts to execute faster.

The info subdirectory has more in-depth information on frawk:

  • Overview what frawk is all about, how it differs from Awk.
  • Types: A quick gloss on frawk's approach to types and type inference.
  • Parallelism An overview of frawk's parallelism support.
  • Benchmarks A sense of the relative performance of frawk and other tools when processing large CSV or TSV files.
  • Builtin Functions Reference: A list of builtin functions implemented by frawk, including some that are new when compared with Awk.

frawk is…




for a Rust based AWK like language
Collapse
kh40sz3r0 profile image
Sergio Marcial Author • Edited on

That is awesome, however, sometimes I feel like we have taken AWK a little too far or as a teammate would say probably not far enough yet

This is a Golang POSIX AWK variant

GitHub logo benhoyt / goawk

A POSIX-compliant AWK interpreter written in Go

GoAWK: an AWK interpreter written in Go

Documentation GitHub Actions Build

AWK is a fascinating text-processing language, and somehow after reading the delightfully-terse The AWK Programming Language I was inspired to write an interpreter for it in Go. So here it is, feature-complete and tested against "the one true AWK" test suite.

Read more about how GoAWK works and performs here.

Basic usage

To use the command-line version, simply use go install to install it, and then run it using goawk (assuming $GOPATH/bin is in your PATH):

$ go install github.com/benhoyt/goawk@latest
$ goawk 'BEGIN { print "foo", 42 }'
foo 42
$ echo 1 2 3 | goawk '{ print $1 + $3 }'
4
Enter fullscreen mode Exit fullscreen mode

On Windows, " is the shell quoting character, so use " around the entire AWK program on the command line, and use ' around AWK strings -- this is a non-POSIX extension to make…