3 ms·
Awk in Lisp as a macro with Lisp AST syntax: http://nongnu.org/txr/txr-manpage.html#N-000264BC http://nongnu.org/txr/txr-manpage.html#N-000264BC * Implements
by kazinator 8y ago
Awk in Lisp as a macro with Lisp AST syntax:
http://nongnu.org/txr/txr-manpage.html#N-000264BC http://nongnu.org/txr/txr-manpage.html#N-000264BC
* Implements almost all salient POSIX features and some Gawk extensions.
* awk expression can be used anywhere an expression is allowed, including nested within another awk invocation. Awk variables are lexically scoped locals: each invocation has its nf, fs, rec and others.
* awk expression returns a useful value: the value of the last form in the last :end clause.
* can scan sources other than files, such as in-memory string streams, strings and lists of strings.
* supports regex-delimited record mode, and can optionally keep the record separator as part of the record (via "krs" Boolean variable).
* unlike Awk, range expressions freely combine with other expressions including other range expression.
* ranges are extended with semantic 8 variations, for succinctly expressing range-based situations that would require one or more state flags and convoluted logic in Awk: http://nongnu.org/txr/txr-manpage.html#N-000264BC http://nongnu.org/txr/txr-manpage.html#N-000264BC
* strongly typed: no duck-typed nonsense of "1.23" being a number or string depending on how you use it. Only nil is false.
Recently accepted Unix Stackexchange answer featuring awk macro: https://unix.stackexchange.com/questions/316664/change-specific-part-of-file-via-a-shell-script/316752#316752 https://unix.stackexchange.com/questions/316664/change-speci...