News for hackers. Stuff that matters.
Re:Awk: The Power and Promise of a 40-Year-Old Language by abecedarius on Tuesday September 07, 2021 @03:45PM (#28448990)
A nice thing about awk vs. Perl/Python: there's a small focused set of things to learn. Once you learn them you're done.

This suggests an opening for a Perl/Python intro focused on the exact same tasks, admittedly. That seems more realistic for Perl -- unless there's someone who writes Python one-liners at the shell?

Re:Awk: The Power and Promise of a 40-Year-Old Language by r-bar on Tuesday September 07, 2021 @04:47PM (#28449747)
I don't think true python "one liners" are a thing, but the awkward thing about awk is sits in this place where what you are doing is complicated enough you need awk, but simple enough you need a one liner? Those cases have been exceedingly few and far between for me enough that every time I want to reach for awk I have to go lookup how to do anything more complex than printing fields. That completely defeats the point of the quick one liner.

May as well open up vim, write my 7 lines of python, and run it. Because I use it everyday and didn't have to look anything up it ends up far faster. Then when I am done I either delete it, throw it in a scripts directory, or make it part of some existing infrastructure repo. Now if I keep it because I used python it is much more readable than the awk 1 liner would have been.

I have tried in earnest to memorize awk's idiosyncrasies multiple times now. By the time I go to use what I learned the last time it is months later and I have forgot enough I need to go look stuff up.

So in a way, here I am: The guy that writes "one liners" in python.

Re:Awk: The Power and Promise of a 40-Year-Old Language by lbhdc on Tuesday September 07, 2021 @05:36PM (#28450274)
I think that is a good point, that often writing a short python script is usually the best solution.

I use awk (and python) daily at work. I work with a lot of flat files, and I use awk when I am doing data quality checks. One of the "sweet spots" it hits for me is when I need to group data by value, or other relatively simple aggregations.

Re:Awk: The Power and Promise of a 40-Year-Old Language by abecedarius on Tuesday September 07, 2021 @05:09PM (#28449991)
Yeah, it's a different world from when I learned Awk. You might enjoy the (very short) book by the creators just because it's a great focused expression of the Unix way. But nobody needs to learn it.
Re:Awk: The Power and Promise of a 40-Year-Old Language by fomine3 on Wednesday September 08, 2021 @01:49AM (#28453515)
Perl is sometimes "better awk".
Re:Awk: The Power and Promise of a 40-Year-Old Language by u801e on Tuesday September 07, 2021 @07:43PM (#28451206)
perl actually has a one-liner way of invocation that's modeled after awk.

For example, to print the first field of a line work the default delimiter could be accomplished in perl by running:

    perl -ane 'print $F[0], "\n"'
Where $F[0] is the equivalent of $1 in awk.