
@awkhubio usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
Joined November 2015
- Tweets1.6K
- Following2.7K
- Followers686
- Likes4.4K
awkhub retweeted
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 👥
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-…
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
awkhub retweeted
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.
awkhub retweeted
Holy crap.
Rick and Morty just explained Jev AI to me better than any tech demo could.
This media is unavailable





























