News for hackers. Stuff that matters.
Re:Why you should learn at least a little bit of Awk by jakevoytko on Wednesday September 29, 2010 @08:23AM (#1739083)
"nothing stops you from generalizing this to say a frame from a video"

This is 100% true. A coworker of mine implemented an elevation-bitmap-to-3d-model conversion tool in 160 lines of Awk. It ran faster than our "good" Matlab tool by a factor of 10.

Awk (or Perl) doubles the usefulness of Unix. Most of the common commands in Unix are query commands. When you need to start manipulating queried data, Awk is where the rubber meets the road. Piping data through the shell stops being read-only, and becomes interactive.

Re:Why you should learn at least a little bit of Awk by silentbicycle on Wednesday September 29, 2010 @01:05PM (#1740135)
> It ran faster than our "good" Matlab tool by a factor of 10.

Could you give a bit more details there? I don't have any experience with matlab, but I tend to think of awk as fast to write code in (and start up), though not particularly fast in execution. (Roughly on par with Python, i.e., usually good enough.)

Re:Why you should learn at least a little bit of Awk by goosemo on Wednesday September 29, 2010 @01:40PM (#1740284)
Re:Why you should learn at least a little bit of Awk by silentbicycle on Wednesday September 29, 2010 @01:46PM (#1740312)
That's mawk. I'm talking about the implementation that post calls "nawk", and either way, I mean orders of magnitude - I care about a 10-100+x difference in speed, not a 1.1-5x one. Awk and Python fall in roughly the same performance tier for that kind of code.

Also: "I have since found large datasets where mawk is buggy and gives the wrong result. nawk seems safe." makes me uneasy, as does the fact that it was unmaintained for a while.

Re:Why you should learn at least a little bit of Awk by _delirium on Wednesday September 29, 2010 @04:17PM (#1740981)
Afaict, mawk's maintenance seems to be a bit up in the air--- the original maintainer basically disappeared years ago and hasn't blessed any successor, so the Debian-patched version became the de-facto current version, since at least it staved off bitrot. Recently someone (Thomas Dickey) picked up maintenance of a new upstream version unilaterally, starting from the Debian-patched version, but he hasn't managed to convince the Debian mawk maintainer to accept his new version as a new upstream (somewhat testy thread here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=554167). I'm personally a little more comfortable with something actively maintained like gawk, despite the speed differences.
Re:Why you should learn at least a little bit of Awk by silentbicycle on Wednesday September 29, 2010 @04:27PM (#1741020)
Right. I usually use (n)awk because it's the default on OpenBSD, but have to admit gawk's artificial-filesystem-based networking support is pretty cool.
Re:Why you should learn at least a little bit of Awk by silentbicycle on Thursday September 30, 2010 @12:15AM (#1742257)
Ultimately, what are you implying? Am I wrong? Awk (any implementation) isn't as fast as C, LuaJIT, or OCaml. It's likely to be good enough for many things, though (certainly prototyping), and it's definitely convenient for quick scripts.