awkhub (@awkhub) profile picture

@awkhubio usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]

Joined November 2015
I gave awk, Miller, and Python the same 1M-row CSV and asked for revenue by region. Same file. Same answer. Very different stopwatches. awk: 0.37s Miller (mlr): 1.65s Python: 2.95s awk won by 4.5x. Then I fed them a product name with a comma in it. "widget, deluxe", 8 units at $115.49. Miller: $943.92. Correct. awk: $20.00. It silently dropped $923.92 and exited 0. That's the whole story. awk is faster because it doesn't know what a CSV is. It sees commas. Miller sees fields. My one-liner: mlr --csv put '$revenue = $units * $price' then stats1 -a sum -f revenue -g region then sort -nr revenue_sum sales.csv Three things I tripped over: 1. Forget --csv and mlr prints nothing. Exit 0. No error. 2. group-by alone doesn't add anything up. You need stats1 -g region. 3. mlr prints raw floats: 443331015.0799997. No pretty cents. And awk's own trap: skip NR>1 and you get a phantom row called "region" worth $0.00. Verdict: awk for scripts where I control the data. Miller for CSVs other humans touched. Speed is the wrong scoreboard here. When did a comma in your data last cost you real money — and how long before you noticed? If you wrangle CSVs for a living, follow along — I test a tool like this every morning. 🔵 Fellow Premium members, let's connect! I post about AI & tech — follow for more 👥
8
1
3
203
awkhub retweeted
Search And Play - Shell scripts to search and play youtube videos from the terminal using only core-utilities. The script scrapes search results from Invidious and parses them with awk. github.com/N-R-K/search-and-…
1
2
193
Using awk for more deterministic results with AI. #awkai
1
141
Using AI (grok) to create comics with accurate code is a challenge. Here is why according to Grok.
146
Involution explained with a basic awk example. Thanks @karakfa for the suggestion. Created with #Grok and checked with #GoogleGemini. Lots of iterations for a simple concept. More lessons in triple checking AI accuracy.
🤖 Made with AI
2
5
273
Script corrected from the comic version.
44
Sysadmins, What was the best AWK/SED/Perl/KSH script and is it still in use?
1
1
2
76
What is involution with math focus. #involution
🤖 Made with AI
2
185
idempotent basic. A basic explanation, updated. Thank you. #idempotent
1
158
Idempotent code means running it once or ten times leaves the system in the same intended state. The extra runs are no-ops once the goal is already met. #idempotentawk #idempotent
2
3
196
One awk one-liner I use constantly: filter one file by the keys in another. NR==FNR — the trick that joins BED / VCF / TSV files without ever loading them into R or Python.
1
3
8
1,671
Holy crap. Rick and Morty just explained Jev AI to me better than any tech demo could.
252
1,312
284
11,384
1,642,711
TLA+ and Lean for design and system verification. #awkhub #tlaplus #tla
1
155
With the advent of "AI", you have no reason not to learn post-2012 Fortran, including CUDAFortran. Or AWK. Or the R programming language. Or how to package software in the native format of the OS. Or assembler for the instruction set architecture of your choice.
1
1
5
197
Jev and awk use cases. #jevawk #jev #awkhub
2
196