[nycbug-talk] useless use of awk? how to fix?
Jesse Callaway
bonsaime at gmail.com
Thu May 3 20:07:32 EDT 2012
This is OBVIOUSLY an rhel/vmware related example, but check it out...
rpm -qa | awk 'BEGIN {x=0} /^vmware-tools/ {x++; pkgs[x] = $1} END{
print "yum -y remove \\"; for (y = 1; y < x; y++) print pkgs[y] " \\";
print ";"}' | awk -F '-[[:digit:]]' '{print $1}'
Yeah, it could be wrapped in an awk system() call instead of finally
piping to the shell, but that would be another construct completely.
Although suggestions for solving that are also welcome. Would love to
see how this could be done more succinctly YET retaining the somewhat
readable instructions.
This was probably best asked a few months ago when the awk specific
talk was fresh in our minds...
--
-jesse
More information about the talk
mailing list