News for hackers. Stuff that matters.
Re:Unix Text Processing (1987) by new_test on Tuesday December 11, 2012 @10:37AM (#4904899)
Is there any advantage (speed?) in using something like Awk over something like Python?
Re:Unix Text Processing (1987) by npsimons on Tuesday December 11, 2012 @04:00PM (#4906778)
Open up a terminal on Linux, OSX, or heck even Cygwin or MinGW on Windows. I'm willing to bet that awk is already pre-installed, even on a base or fresh install. Awk, like grep, sed and all the rest are pretty standard and very powerful. Not knocking Python, shell programming is just another paradigm, and the tools are pretty universally available.
Re:Unix Text Processing (1987) by dredmorbius on Tuesday December 18, 2012 @12:46AM (#4936226)
Awk is part of the POSIX specification, so yes, it's going to be present on pretty much any Unix-like environment. Even those which don't aim at POSIX compliance will almost certainly have an awk interpreter. Busybox includes one, which means that many minimal / embedded systems will include awk by default (as they use busybox to provide core utilities).
Re:Unix Text Processing (1987) by ralph on Tuesday December 11, 2012 @01:40PM (#4905976)
It's awkward to embed Python in a pipeline and the awk can be quicker to write if the problem suits its domain. Execution speed may be slower than Python, depends on the work needed and the awk used; gawk, mawk, Kernighan's One True awk, ...

    awk 'NR > 3 && !/foo/ {s += $(NF - 2)} END {print NR, s + 0}'