Live data from Hacker News

The Awk Programming Language

awk.dev

101–110 of 159 posts

Re: The Awk Programming Language

#101
post #98

I know lots of people like awk, but I pretend it doesn't exist. Why? Here's my comment on this from 6 years ago[0], >I used awk until I learned Python (long ago). For me, awk was yet another example of the "worse is better" approach to things so common in unix. For example, if you make a syntax error, you might get a message like "glob: exec error," rather than an informative message. "Worse is better" is probably a…

You are missing out. As a former data engineer/current SRE, I spend my entire day with VSCode/Python/Notebooks/CoPilot banging out python code - but whenever I need to do a complex analysis of a semistructured text file in Awk's claim to fame in my world is that it's cognitive activation energy for anyone who has taken the 3-4 hours to learn the language from start to finish (and that's the awesome thing about the la…

Point taken. I have a Python program that is an elemental version of awk, and I use that for the odd task. I can modify it if needed and I have the entire Python library to help me. Is the text Unicode? HTML? These little details matter.

I'm not complaining that someone banged out awk (speaking figuratively) on a Friday afternoon to do something and not have to stay after work. Excellent! My complaint is that the failure to address technical debt has negatively affected the productivity of millions, if not tens of millions, of people, often working under pressure, for DECADES.

Re: The Awk Programming Language

#102
post #25

I was privileged to be one of the technical reviewers for this book. There's a fair bit of the original content (which is still great), but Kernighan's done a great job with some good restructuring and some significant updates, too. The early chapters are very hands-on, with something of a focus on "exploratory data processing", particularly with CSV files. Big data with AWK, you could say. Gawk and awk will soon hav…

Its a crying shame we never settled on a control character separated text format. There's a ascii control characters for record and field (unit) separators. A bit of user space support for that would have been great.

Miller handles it.

* https://miller.readthedocs.io/en/6.8.0/file-formats/#csvtsva...

I have programs that handle it.

* https://jdebp.uk/Softwares/nosh/guide/commands/console-flat-...

Re: The Awk Programming Language

#103
post #25

I was privileged to be one of the technical reviewers for this book. There's a fair bit of the original content (which is still great), but Kernighan's done a great job with some good restructuring and some significant updates, too. The early chapters are very hands-on, with something of a focus on "exploratory data processing", particularly with CSV files. Big data with AWK, you could say. Gawk and awk will soon hav…

This is amazing, I may never use pandas again

Re: The Awk Programming Language

#104
post #21

Earlier quoted context omitted.

This is exactly why I moved from AWK to Perl for these quick jobs a couple of years ago. If you stick to an AWK-like subset, Perl is also simple, fast and lightweight. If you want to grow your scripts (and you have a lot of discipline) Perl – in contrast to AWK – gives you enough noose to hang^W^W^W^Wthe tools you need.

Perl? Wow. Is that better than bash, python or even nodejs? Why write in Perl over these? Serious question, was propaghandized to hate Perl.

When discussing such languages, I would like to point out that Raku is also an option.

Re: The Awk Programming Language

#106

I love using Awk, the only thing I miss is that it can't handle complex csv files. Does anyone know how to handle quoted CSV strings like > "foo","bar,baz"

Convert it with Miller first:

    mlr --icsv --otsv cat examplefile
* https://miller.readthedocs.io/en/latest/10min/

Re: The Awk Programming Language

#107
post #25

I was privileged to be one of the technical reviewers for this book. There's a fair bit of the original content (which is still great), but Kernighan's done a great job with some good restructuring and some significant updates, too. The early chapters are very hands-on, with something of a focus on "exploratory data processing", particularly with CSV files. Big data with AWK, you could say. Gawk and awk will soon hav…

Would you say the first few chapters are enough to get the 75-80% usefulness for mere mortals like me who will never try to master the full language? Or is the material fairly sprinkled throughout the whole tome?

Re: The Awk Programming Language

#109
post #88

Earlier quoted context omitted.

gnuplot is an alternative that is available on almost as many systems as awk, and can do the job as well edit: this prompted me to write up a little note showing how: https://notes.billmill.org/visualization/graphs/gnuplot/A_ba...

If you do this sort of thing more than once ever, look at the feedgnuplot tool ( http://github.com/dkogan/feedgnuplot ). It'll make your life easier

Neat! Once you're installing something to do terminal plots though, https://github.com/red-data-tools/YouPlot looks the nicest I've seen.

(The nice feature of feedgnuplot of course is that you can _also_ render the plots to images, which youplot can't)

Re: The Awk Programming Language

#110
post #98

I know lots of people like awk, but I pretend it doesn't exist. Why? Here's my comment on this from 6 years ago[0], >I used awk until I learned Python (long ago). For me, awk was yet another example of the "worse is better" approach to things so common in unix. For example, if you make a syntax error, you might get a message like "glob: exec error," rather than an informative message. "Worse is better" is probably a…

You are missing out. As a former data engineer/current SRE, I spend my entire day with VSCode/Python/Notebooks/CoPilot banging out python code - but whenever I need to do a complex analysis of a semistructured text file in Awk's claim to fame in my world is that it's cognitive activation energy for anyone who has taken the 3-4 hours to learn the language from start to finish (and that's the awesome thing about the la…

In general Perl fits that niche for me better, but sometimes awk is what you have.
Post reply on HN