Hacker News new | ask | show | jobs
by mywittyname 1704 days ago
Awk is handy for bash programming. It's one of those weird tools in the box that is extremely useful in a very few specific scenarios, and that's what is keeping it alive.

No sane person is going to write an entire application in Awk anymore. But there are certainly 20 years old there who will encounter Awk while doing some command line data munging via SO and it will slowly become a tool in their toolbox.

Perl doesn't really have that. Sure you can ` | perl -e "..."` but honestly, I can do that with python/PHP too. I haven't encountered an SO answer for command line data processing hacks that have used perl in ages.

3 comments

There is a book, "Minimal Perl", that is entirely about that usecase. I found it convincing, 15 years ago, and the only Perl I use are those terse command line snippets it teached, when others might use some combination of grep, sed and awk. I don't know if it is the best tool for the job, but it has worked for me.
I wrote an Awk script a few weeks ago precisely because I needed to filter some text. Python would be more verbose than I needed, Sed would become a write-only mess, but Awk in a Bash wrapper was just right.
Perl is much more than jq, but in the specific use-case of munging data on the command line, who is going to reach for Perl in a world of JSON APIs ?