Earlier quoted context omitted.
The biggest reason to learn AWK, IMO, is that it's on pretty much every single linux distribution. You might not have perl or python. You WILL have AWK. Only the most minimal of minimal linux systems will exclude it. Even busybox includes awk. That's how essential it's viewed.
I'm curious what linux distros don't have either some version of perl or python. I like awk, mind, but this is not necessarily (IME) a good argument for it.
Awk: The Power and Promise of a 40-Year-Old Language
61–70 of 122 posts
Re: Awk: The Power and Promise of a 40-Year-Old Language
#62Earlier quoted context omitted.
Probably as much for legacy reasons as anything else. Perl was the chosen scripting language for utilities, it works, they understand it, and they've kept with it. Sort of how they stay with CVS for their source repository. Python isn't even installed on a base OpenBSD system.
Mark Espie rewrote the entire package system in perl in 2010, which is a bit late to be classed as legacy. https://undeadly.org/cgi?action=article;sid=20100323141307 I'm not sure what was used for the version before this, but the original BSD package system was written in C.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#63Earlier quoted context omitted.
It does not. The pipe command leaves the pipe open and successive pipes with identical strings remain open until the pipe is explicitly closed. [edit] Here's the link to the gawk documentation, but most flavors of AWK work similarly: https://www.gnu.org/software/gawk/manual/gawk.html#Close-Fil...
Wow, this is amazing. It really shows how complexity should be managed in the tool so that the user can do the naive thing and have it be accidentally optimal
Re: Awk: The Power and Promise of a 40-Year-Old Language
#64Earlier quoted context omitted.
The biggest reason to learn AWK, IMO, is that it's on pretty much every single linux distribution. You might not have perl or python. You WILL have AWK. Only the most minimal of minimal linux systems will exclude it. Even busybox includes awk. That's how essential it's viewed.
I'm curious what linux distros don't have either some version of perl or python. I like awk, mind, but this is not necessarily (IME) a good argument for it.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#65Earlier quoted context omitted.
I had to take large CSV files like {question, right_ans, wrong_ans1, wrong_ans2, wrong_ans3} and covert them into SQL insert files. Few caveats - some could be duplicates, some characters were not allowed, and some had formatting issues. The first issue was avoided by upserting, but the other two I used Awk and Sed for and put together a fairly robust script far quicker than if I reached for Python. I probably would…
"""I probably would have reached for Python if I realised how many edge cases there were""" This is the counter for all the "success" stories of awk users that walked away with an underspecced and underdeveloped 5 minute solution.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#66Earlier quoted context omitted.
The biggest reason to learn AWK, IMO, is that it's on pretty much every single linux distribution. You might not have perl or python. You WILL have AWK. Only the most minimal of minimal linux systems will exclude it. Even busybox includes awk. That's how essential it's viewed.
I'm curious what linux distros don't have either some version of perl or python. I like awk, mind, but this is not necessarily (IME) a good argument for it.
I imagine that DamnSmallLinux or TinyCoreLinux possibly don't have them by default. Their focus is to be as small as possible in order to download quickly and fit in a USB drive or CD. Their small size was more important back when speeds were slower and drives were smaller. They were also good for when you had a limited number of storage options and you wanted the running OS to fit completely in RAM (back when RAM was smaller).
Re: Awk: The Power and Promise of a 40-Year-Old Language
#67Earlier quoted context omitted.
The biggest reason to learn AWK, IMO, is that it's on pretty much every single linux distribution. You might not have perl or python. You WILL have AWK. Only the most minimal of minimal linux systems will exclude it. Even busybox includes awk. That's how essential it's viewed.
I'm curious what linux distros don't have either some version of perl or python. I like awk, mind, but this is not necessarily (IME) a good argument for it.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#68I never use Awk until last year. I wanted to monitor an embedded device with little more than bustbox and python on it. There was quite a bit of information in the log files (I had already written a custom log file viewer with some highlighting) but I wanted to monitor in real-time. Somehow I decided to use Awk to monitor the tail of the log file and do realtime bar-graphs by generating appropriate cursor control seq…
The biggest reason to learn AWK, IMO, is that it's on pretty much every single linux distribution. You might not have perl or python. You WILL have AWK. Only the most minimal of minimal linux systems will exclude it. Even busybox includes awk. That's how essential it's viewed.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#69i no longer use it but Perl was always the better solution when one thought AWK was the answer. Perl will do those things where AWK really shines and if the problem got bigger, Perl was easier to deal with.
The problem is that awk is a very simple language, which you can learn in an afternoon. Perl is a very complex language, and is not used anymore, so you're just spending your time on something you'll rarely use.
Re: Awk: The Power and Promise of a 40-Year-Old Language
#70Earlier quoted context omitted.
Ehh. Until the 'job' gets extended and then your simple tool makes it exponentially more complex and you have to rewrite it with the more powerful tool.
Choosing a "good enough for the medium term with minimal effort now" is a winner in my book, even if it's likely to be rewritten in the long term.