xonix | 2 years ago | on: SectorC: A C Compiler in 512 bytes
xonix's comments
xonix | 3 years ago | on: Brian Kernighan adds Unicode support to Awk
xonix | 3 years ago | on: Why GNU grep is fast (2010)
xonix | 3 years ago | on: Perl is still relevant
No doubt Perl is much more powerful than AWK. But from other side it’s astonishing that such succinct and clear language as AWK was turned into a monstrosity called Perl.
Therefore, for me when it goes to text processing/manipulation I prefer AWK much better than Perl. Cleaner syntax, better portability, absolute minimalism. Now, thanks to GoAWK [0] CSV-processing with AWK is a piece of cake too.
I personally see no reason nowadays for me to write any Perl code, but I’m totally fine to use the software written in it.
xonix | 4 years ago | on: Frawk: A fast, JITted, statically-typed AWK written in Rust
Not long ago I was really fascinated by this example I came across: https://pmitev.github.io/to-awk-or-not/Python_vs_awk/.
xonix | 4 years ago | on: Frawk: A fast, JITted, statically-typed AWK written in Rust
To my knowledge the major dialects in use are:
- One True Awk (aka bwk) (https://github.com/onetrueawk/awk) - this one is bundled in all *BSD/macOS
- Gawk (https://www.gnu.org/software/gawk/) - this one is bundled in most Linux
- mawk (https://invisible-island.net/mawk/) - bundled in some Linux distros (?), known as the fastest byte-code compiled implementation.
All three have very good compatibility, but Gawk is super-set over POSIX standard. I have some evidence here, since I regularly test [1] against these implementations and even some others, like GoAWK.
[1] https://github.com/xonixx/makesure/actions/runs/1830978431
xonix | 4 years ago | on: Frawk: A fast, JITted, statically-typed AWK written in Rust
I myself been dedidacted Python lover in past for many years now came to a conclusion that what can be scripted with AWK, should be scripted in AWK (over Python, Ruby, Perl, etc.). I'm not saying that you should write big apps though, but for small scripts AWK is absolutely fine alternative to major scripting languages with lots of benefits. Been universally available (as part of POSIX) and very compliant (language standard is almost unchanged for over 30 years now). As they say: "Good programmer chooses the most powerful tool for the job, best programmer chooses the least powerful tool for the job". Also see [1].
There is absolutely nothing wrong in learning AWK. It's very small language you can grasp fully in hours or days, and be sure you know it all, since it's very unlikely it chanages any time soon. Besides the classical book [2] by A., W., K. is absolute pleasure to read. Amazing, but it's still totally relevant, despite been published in 1988.
Shameless plug. I'm the author of a task/command runner [3] implemented almost 100% in AWK and I still think this was perfect choice of a language for this project.
[1] https://en.wikipedia.org/wiki/Rule_of_least_power
[2] https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_P...
xonix | 4 years ago | on: How to write idempotent Bash scripts (2019)
xonix | 4 years ago | on: Welcome to C# 10
xonix | 4 years ago | on: A Git Implementation in Awk
xonix | 4 years ago | on: A Git Implementation in Awk
You can already install it from marketplace.
xonix | 4 years ago | on: Ugit - DIY Git in Python
xonix | 4 years ago | on: The KDL Document Language
xonix | 4 years ago | on: Big list of HTTP static server one-liners
[1] https://github.com/xonixx/serv
[2] https://medium.com/cmlteam/develop-a-utility-on-graalvm-cc16...
xonix | 5 years ago | on: How to do things safely in Bash (2018)
Why?
1. Portability (AWK is a part of POSIX)
2. Very clean syntax
3. Powerful associative arrays
4. Super-powerful string manipulations facilities
5. Easy shell interoperability
As an example here is a simplistic build tool [1] I’ve developed in AWK. As you can check [2] it runs unchanged under Linux/macOS/Win (via Git Bash).
[1] https://github.com/xonixx/makesure/blob/main/makesure.awk
[2] https://github.com/xonixx/makesure/actions/runs/702594092
xonix | 5 years ago | on: Gron – Make JSON Greppable
xonix | 5 years ago | on: Q: A faster re-implementaiton of jq written in Reason Native/OCaml
xonix | 5 years ago | on: Q: A faster re-implementaiton of jq written in Reason Native/OCaml
xonix | 5 years ago | on: Mastering Jq: Part 1
My approach uses very simple ideas and is heavily based on JS internally. This is simple once you understand it [3] (thus saner DSL) and gives the whole power of JS in your hands.
I've also prepared a basic comparison jq vs jsqry based on some examples in article [4].
It's worth noting that currently the CLI tool [1] is written in Java using Graal VM polyglot native image compilation. Thus HUGE executable size of 95 MB (sic!) because it bundles JS engine. I'm considering rewriting this to QuickJS by Fabrice Bellard [5]. This should make it MUCH smaller.
[1] https://github.com/jsqry/jsqry-cli
[2] https://github.com/jsqry/jsqry
[3] https://jsqry.github.io/#filtering
[4] https://gist.github.com/xonixx/d6066e83ec0773df248141440b18e...
xonix | 6 years ago | on: Show HN: Keycat – A self-hosted end-to-end encrypted password manager